【问题标题】:How to wait for messages from user pyrogram如何等待来自用户热图的消息
【发布时间】:2022-06-16 00:44:03
【问题描述】:

我的代码示例,但是当机器人切换到另一个命令时,这仍然存在 有没有例子说明如何做到这一点?

async def test(client, message):
    user_id = message.chat.id
    await bot.send_message(user_id, "write code:")
    @bot.on_message(filters.private & filters.user(user_id))
    async def get_code(client, message):
        code = message.text```

【问题讨论】:

  • 一种方法是定义步骤(WRITE_NAME=1、WRITE_SURNAME=2、WRITE_CODE=3、COMMAND_1=4 等),并用他的步骤将用户保存到数据库。当用户发送消息时,您会读取有关该用户的数据并检查他所处的步骤。

标签: python telegram pyrogram


【解决方案1】:

send_message() 方法中,您有reply_markup 参数。您可以使用reply_markup中的ForceReply对象为用户打开回复界面。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-18
    • 1970-01-01
    • 1970-01-01
    • 2022-08-23
    • 1970-01-01
    • 1970-01-01
    • 2014-12-15
    • 1970-01-01
    相关资源
    最近更新 更多