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

[ADD] /help command #11

Merged
merged 3 commits into from
Dec 14, 2019
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# Commands

* `/start` → Welcome :)
* `/send [amount]` → Send some money to another person.
* `/balance` → Show the status of all people's wallet
* `/setprice [item] [amount]` → Change the price of an item.
* `/help` → Shows a list of all available commands with their description.
* `/send [amount]` → Send a specific amount of money to another person.
* `/balance` → Shows the status of everyone's wallet.
* `/setprice [item] [amount]` → Change the price of an item (price of box or bottle...).
* `/price` → List of current prices.
* `/buybox` → The user buys a case of club-mate.
* `/drink` → The user drinks a club-mate.
25 changes: 24 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@ const TeleBot = require('telebot');
const Secrets = require('./secrets.json');
const bot = new TeleBot(Secrets.BOT_TOKEN);

bot.on(['/start'], (msg) => {
var commands = {
'list': [
{
'name': "start",
'desc': 'Welcome command'
},
{
'name': "help",
'desc': 'Shows a list of available commands'
}
]
}

bot.on([`/${commands.list[0].name}`], (msg) => {

msg.reply.text("Hello! I am Club Mate Bot, I'm here to help you manage your mate consumption. Please type '/help' to begin!")

});

bot.on([`/${commands.list[1].name}`], (msg) => {
helpmsg = ''

for (var i = 0;i < commands.list.length;i++) {
helpmsg += `${commands.list[i].name} : ${commands.list[i].desc} \n`
}

msg.reply.text(helpmsg)
});

bot.start();