问题描述
我正在尝试学习如何通过 discord.py
制作一个不和谐的机器人,并希望添加一个功能,即每当另一个用户加入机器人的语音频道时,都会从机器人发送消息目前在.我不知道如何使用事件处理程序本身,也没有充分了解他们的文档来使用它.
I am trying to learn how to make a discord bot through discord.py
and wanted to add a feature where a message would be sent from the bot whenever another user joined the voice channel that the bot is currently in. I do not know how to use the event handler itself and didn't understand their documentation enough to utilize it.
根据我对文档的有限理解,只要用户静音、耳聋、离开或加入频道,就应该使用事件处理程序.
From my limited understanding of the documentation, the event handler should be used whenever a user is muted, deafened, leaves, or joins a channel.
但是,即使我试图让它识别这些操作,它也会给我一个错误消息:
However, even when I tried to get it to recognize those actions it gave me an error message of:
推荐答案
2020 年版本.请注意,我的代码在发送的消息方面表现不同.
A version working in 2020. Please not that my code behaves different in terms of the sent message.
这篇关于如何使用 discord.py 事件处理程序 on_voice_state_update 仅在用户加入语音频道时运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!