【问题标题】:how to detect commands in telegram bot (in python)如何检测电报机器人中的命令(在python中)
【发布时间】:2018-11-13 15:55:00
【问题描述】:

我正在开发一个电报机器人

我可以检测和使用来自用户 (update.message.text) 的文本,我想要的是检测用户发送给机器人的每个命令。

有没有办法解决这个问题?

  • python 3.7
  • python-telegram-bot 模块
  • 赢10

【问题讨论】:

标签: python python-3.x telegram-bot


【解决方案1】:

我找到了:

我只是添加MessageHandler(Filters.command, kb_handler)

conv_handler = ConversationHandler(
    entry_points=[CommandHandler('start', start),
                  MessageHandler(Filters.command, kb_handler)],
    states={},
    fallbacks=[]
)

【讨论】:

    猜你喜欢
    • 2018-06-13
    • 1970-01-01
    • 1970-01-01
    • 2021-03-10
    • 2020-10-05
    • 2018-02-27
    • 2017-02-20
    • 2023-03-12
    • 2015-12-14
    相关资源
    最近更新 更多