Handle channel deletions

This commit is contained in:
Oliver Traber 2023-06-25 01:53:12 +02:00
parent 8d01e6ff5a
commit 7597569307
Signed by: Bluemedia
GPG key ID: C0674B105057136C

9
bot.py
View file

@ -80,6 +80,15 @@ async def on_guild_remove(guild):
session.delete(removed_guild) session.delete(removed_guild)
session.commit() session.commit()
@client.event
async def on_guild_channel_delete(channel):
with Session(sqla_engine) as session:
removed_channel = session.get(Channel, channel.id)
if removed_channel == None:
return
session.delete(removed_channel)
session.commit()
@client.tree.command() @client.tree.command()
@app_commands.guild_only() @app_commands.guild_only()
@app_commands.describe( @app_commands.describe(