King Maxine
King Maxine

Reputation: 55

How to work with parameters in telegraf in commands

**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

Upvotes: 3

Views: 6146

Answers (1)

user14915326
user14915326

Reputation: 111

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

Upvotes: 7

Related Questions