我正在尝试制作一个机器人,让成员在语音频道上扮演角色,但由于某种原因它不起作用。
这是代码:
@client.event
async def on_voice_state_update(before, after):
role = discord.utils.get(after.server.roles, name="glosowy")
if not before.voice.voice_channel and after.voice.voice_channel:
await client.add_roles(after, role)
elif before.voice.voice_channel and not after.voice.voice_channel:
await client.remove_roles(after, role)
这是我收到的错误:
Ignoring exception in on_voice_state_update
Traceback (most recent call last):
File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 312, in _run_event
await coro(*args, **kwargs)
TypeError: on_voice_state_update() takes 2 positional arguments but 3 were given
米琪卡哇伊
相关分类