How to work with parameters in telegraf in commands

Viewed 3102

**Hey guys I want to use parameters in my bot **

For example I send /ping hello 5 ctx.reply(You want me to ping hello 5 times)

In the above code /ping is the command while hello and 5 are parameters so I can access them in my codes

In

bot.command('ping')

I don't think it works so I need help to work with parameters

1 Answers

You should parse ctx.update.message.text - it is the full command with other text. For example, ctx.update.message.text.split(' ') returns array of arguments with a command in 0 place

Related