pyTelegramBotAPI版本 - 3.0.1
python的版本: 2.7 / 3.6.1
我想创建一个带参数的命令,例如:
/activate 1
/run programm
怎么做?
答案 0 :(得分:2)
解决方案:
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']