Reputation: 309
pyTelegramBotAPI version - 3.0.1
Version of python: 2.7/3.6.1
I want to create a command with arguments, example:
/activate 1
/run programm
How to do it?
Upvotes: 2
Views: 9605
Reputation: 309
Solution:
def extract_arg(arg):
return arg.split()[1:]
@bot.message_handler(commands=['yourCommand'])
def yourCommand(message):
status = extract_arg(message.text)
/yourCommand 1
status = ['1']
/yourCommand ff
status = ['ff']
Upvotes: 13