From 7597569307f3d78984c94bcc3dc10b668b3a20ec Mon Sep 17 00:00:00 2001 From: BluemediaGER Date: Sun, 25 Jun 2023 01:53:12 +0200 Subject: [PATCH] Handle channel deletions --- bot.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bot.py b/bot.py index 1ec326c..a11cc0b 100644 --- a/bot.py +++ b/bot.py @@ -80,6 +80,15 @@ async def on_guild_remove(guild): session.delete(removed_guild) 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() @app_commands.guild_only() @app_commands.describe(