我试图制作一个不和谐的机器人,当他们聋了自己时,它会移动其他人

时间:2021-01-19 11:45:00

标签: discord.py

这是代码的一部分:

 async def on_voice_state_update(self,member,before,after):
     channel = (800674042247118878)
     if before.self.deaf and after.self_deaf:
        member.move_to = channel

这就是我得到的错误

File "C:\Users\nikos\Desktop\Koimisas\koimisas.py", line 14, in on_voice_state_update
    if before.self.deaf and after.self_deaf:
AttributeError: 'VoiceState' object has no attribute 'self'

1 个答案:

答案 0 :(得分:0)

您需要检查after.deaf

async def on_voice_state_update(self,member,before,after):
     channel = self.bot.get_channel(800674042247118878)
     if after.deaf and after.channel:
        await member.move_to(channel)