【问题标题】:How do I make discord bot display Typing and stop typing when a message is sent发送消息时如何使不和谐机器人显示打字并停止打字
【发布时间】:2021-02-25 18:55:54
【问题描述】:

我希望我的 discord 机器人在他打字时显示正在打字的消息,当他发送消息时,他会停止打字。与 message.channel.typing 的异步似乎不起作用,因为即使在发送消息后,机器人也会继续输入。

【问题讨论】:

    标签: python-3.x discord.py


    【解决方案1】:

    您可以使用Context.trigger_typing 方法:

    @bot.command()
    async def send_typing(ctx):
        await ctx.trigger_typing()
        await asyncio.sleep(10)
        await ctx.send('End of typing')
    

    参考:

    【讨论】:

      猜你喜欢
      • 2021-05-30
      • 2019-12-10
      • 2021-08-07
      • 1970-01-01
      • 1970-01-01
      • 2022-11-02
      • 2021-04-03
      • 2021-04-25
      • 2020-12-18
      相关资源
      最近更新 更多