I'm trying to get my discord bot to disconnect users who get moved to the AFK channel. all works well with that except it tries to disconnect users who just enter talk channels, not just when you get moved to the AFK channel. I have to set permissions to not allow the bot to move or disconnect from those channels, so it keeps pulling up Missing permissions. Would love it to ignore those other voice channels.
i'm not sure how to exclude a voice channel so I tried
if discord.VoiceChannel.id == id:
return
to no avail. I've tried setting the bot to not see those channels through discord but it still does and still tries to disconnect people.
@client.event
async def on_voice_state_update(member = discord.Member, before = discord.VoiceState.channel, after = discord.VoiceState.afk):
await member.move_to(channel = None, reason = None)
Im guessing it's something basic but not sure how to ignore the other channels.
I thought the API said the before = discord.VoiceState.channel
refers to a members recent voice channel, none if they weren't in one, then when they go to the AFK channel, after = discord.VoiceState.afk
it would disconnect. Am i interpreting that wrong? I'm obviously missing something