Expected Result:
- I want that only the Channel in the category_1 are getting checked.
- And i want that the Channels are deleted when nobody are in there, like Temp Channels i think
My Code:
@bot.listen()
async def on_voice_state_update(event):
guild_1 = bot.get_guild(0)
category_1 = await guild_1.fetch_channel(0)
channel_1 = bot.get_channel(0)
if event.channel.category.id == category_1.id:
if event.channel and len(event.channel.members) == 0:
try:
await event.channel.delete()
except:
await channel_1.send(f"The Channel: {event.channel.mention} was not deleted.")
Error:
Ignoring exception in VoiceStateUpdate():
Traceback (most recent call last):
File "/user/.pyenv/versions/3.12.5/lib/python3.12/site-packages/interactions/client/client.py", line 622, in _async_wrap
await _coro(_event, *_args, **_kwargs)
File "/user/.pyenv/versions/3.12.5/lib/python3.12/site-packages/interactions/models/internal/callback.py", line 32, in __call__
return await self.callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bot.py", line 178, in on_voice_state_update
if event.channel.category.id == category_support.id:
^^^^^^^^^^^^^
AttributeError: 'VoiceStateUpdate' object has no attribute 'channel'