Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VER] Bump to v0.6.0 #52

Merged
merged 6 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
1. Communicate with [@BotFather](https://t.me/BotFather) to create a bot and get the token.
1. Rename `secrets.sample.json` to `secrets.json`.
1. Replace the `BOT_TOKEN` key in the `secrets.json` file with the bot token.
1. Go on [Giphy get api key](https://support.giphy.com/hc/en-us/articles/360020283431-Request-A-GIPHY-API-Key) and follow the instructions to get an API key.
1. Replace the `API_KEY` key in the `secrets.json` file with the api key you were provided with.
1. Run `npm i` to install the node dependencies.
1. Run script with `node index.js`.

# Commands

* `/start` → Welcome :)
* `/about` → Shows bot version, bug report, etc...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sur about the /drink branch ?

* `/help` → Shows a list of all available commands with their description.
* `/send <@username> <amount>` → Send a specific amount of money to another person.
* `/balance` → Shows the status of everyone's wallet.
Expand Down
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,19 @@ bot.on(`/${commands.list[2].name}`, (msg) => {

// /drink command
bot.on(`/${commands.list[3].name}`, (msg) => {
let gifWords = ['bottle', 'alcohol', 'cheers', 'drink', 'party']
let pickedWord = gifWords[Math.floor(Math.random() * gifWords.length)]
console.log(pickedWord)
fetch(`https://api.giphy.com/v1/gifs/random?api_key=${Secrets.API_KEY}&tag=${pickedWord}&limit=1&offset=0&rating=G&lang=en`)
.then(res => res.json())
.then(json => {
json

msg.reply.video(`${json.data.images.original.url}`, {caption: `Cheers @${users[msg.chat.id][msg.from.id].username}!\nYou currently have ${users[msg.chat.id][msg.from.id].wallet} ${options[msg.chat.id].currency} in your wallet!`})
})
.catch(err => console.error(err))
users[msg.chat.id][msg.from.id].wallet -= 2
utils.writeUsersDataToFile(users)
msg.reply.text(`Cheers @${users[msg.chat.id][msg.from.id].username}!\nYou currently have ${users[msg.chat.id][msg.from.id].wallet} ${options[msg.chat.id].currency} in your wallet!`)
})

// /buybox command
Expand Down
91 changes: 91 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion secrets.sample.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{ "BOT_TOKEN" : "123456789:AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQR" }
{
"BOT_TOKEN" : "123456789:AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQR",
"API_KEY" : "AaAaAAaaaBbbbBCcccCcccC"
}