From 9561a32e52925813902bb7054c6c6b5a28e32877 Mon Sep 17 00:00:00 2001 From: tiltowait Date: Sun, 9 May 2021 11:04:54 -0700 Subject: [PATCH] Remove initiative when the channel is deleted --- masquerade.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/masquerade.py b/masquerade.py index f29e852..f243241 100644 --- a/masquerade.py +++ b/masquerade.py @@ -440,6 +440,13 @@ async def on_guild_update(_, after): storyteller.engine.statistics.rename_guild(after.id, after.name) +@bot.event +async def on_guild_channel_delete(channel): + """Removes initiative from the deleted channel.""" + print(f"Deleted #{channel.name} on {channel.guild.name}. Removing initiative.") + storyteller.initiative.remove_table(channel.id) + + @bot.event async def on_command_error(ctx, error): """Ignore CommandNotFound errors."""