From f44c8a778f7e49cf1e6c996ae6cae837618a95d5 Mon Sep 17 00:00:00 2001 From: Gefaehrbert <138185406+degnedict@users.noreply.github.com> Date: Sat, 25 May 2024 18:54:50 +0200 Subject: [PATCH] Update bot.py --- bot.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 36f44a5..f57a4c3 100644 --- a/bot.py +++ b/bot.py @@ -24,12 +24,10 @@ async def on_voice_state_update(member, before, after): reason='Created by JoinToCreate bot' ) await member.move_to(new_channel) - # Mark the channel as created by the bot by adding a custom attribute - new_channel.created_by_bot = True if before.channel and len(before.channel.members) == 0 and before.channel.id != join_to_create_channel_id: - # Check if the channel was created by the bot before deleting it - if hasattr(before.channel, 'created_by_bot') and before.channel.created_by_bot: + # Check if the channel was created by the bot by checking its name + if before.channel.name.startswith('🔊'): await before.channel.delete(reason='No members left in the bot-created channel') bot.run(token)