Switch to Python #2
6
bot.py
6
bot.py
@@ -24,12 +24,10 @@ async def on_voice_state_update(member, before, after):
|
|||||||
reason='Created by JoinToCreate bot'
|
reason='Created by JoinToCreate bot'
|
||||||
)
|
)
|
||||||
await member.move_to(new_channel)
|
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:
|
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
|
# Check if the channel was created by the bot by checking its name
|
||||||
if hasattr(before.channel, 'created_by_bot') and before.channel.created_by_bot:
|
if before.channel.name.startswith('🔊'):
|
||||||
await before.channel.delete(reason='No members left in the bot-created channel')
|
await before.channel.delete(reason='No members left in the bot-created channel')
|
||||||
|
|
||||||
bot.run(token)
|
bot.run(token)
|
||||||
|
|||||||
Reference in New Issue
Block a user