How to server undeafen a member in discord.py

I want to automatically undeafen members in my server with a bot.

I know that I can unmute a member with member.edit(mute = False) so I thought that I could use the following command: member.edit(deaf = False) since deaf is an attribute of VoiceState just like deaf but it doesn’t seem to work.

@commands.Cog.listener()
    async def on_voice_state_update(self, member, before, after):
        if after.mute:
            await member.edit(mute = False)
            
        if after.deaf:
            await member.edit(deaf = False)

The “mute” part works and the if after.deaf: works too, so the problem is with await member.edit(deaf = False).

Answer

It’s not deaf but deafen

await member.edit(deafen=False)

Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *