Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
pyTelegramBotAPI 版本 - 3.0.1
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)
/你的命令 1
status = ['1']
/你的命令 ff
status = ['ff']