Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如何使discord bot显示键入并在发送消息时停止键入_Python 3.x_Discord.py - Fatal编程技术网

Python 3.x 如何使discord bot显示键入并在发送消息时停止键入

Python 3.x 如何使discord bot显示键入并在发送消息时停止键入,python-3.x,discord.py,Python 3.x,Discord.py,我希望我的discord机器人在键入时显示键入消息,当他发送消息时,他停止键入。与message.channel.typing异步似乎不起作用,因为即使在发送消息后,bot仍会继续键入。您可以使用上下文。触发键入方法: @bot.command() 异步def发送_键入(ctx): 等待ctx.trigger_键入() 等待异步睡眠(10) 等待ctx.send('键入结束') 参考:

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

您可以使用
上下文。触发键入方法:

@bot.command()
异步def发送_键入(ctx):
等待ctx.trigger_键入()
等待异步睡眠(10)
等待ctx.send('键入结束')
参考: