【发布时间】:2021-02-25 18:55:54
【问题描述】:
我希望我的 discord 机器人在他打字时显示正在打字的消息,当他发送消息时,他会停止打字。与 message.channel.typing 的异步似乎不起作用,因为即使在发送消息后,机器人也会继续输入。
【问题讨论】:
标签: python-3.x discord.py
我希望我的 discord 机器人在他打字时显示正在打字的消息,当他发送消息时,他会停止打字。与 message.channel.typing 的异步似乎不起作用,因为即使在发送消息后,机器人也会继续输入。
【问题讨论】:
标签: python-3.x discord.py
您可以使用Context.trigger_typing 方法:
@bot.command()
async def send_typing(ctx):
await ctx.trigger_typing()
await asyncio.sleep(10)
await ctx.send('End of typing')
【讨论】: