命令与参数pyTelegramBotAPI
pyTelegramBotAPI版本 - 3.0.1命令与参数pyTelegramBotAPI
Python版本:2.7 /3.6.1
我想创建带有参数的命令,例如:
/activate 1 /run programm
怎么做?
回答:
解决方案:
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']
以上是 命令与参数pyTelegramBotAPI 的全部内容, 来源链接: utcz.com/qa/266807.html