From f9a8d6ddf69b32e418df17d9efa3fa8f5b1e73e2 Mon Sep 17 00:00:00 2001 From: profitroll Date: Sat, 6 May 2023 18:31:07 +0200 Subject: [PATCH] Fixed unexpected behavior --- cogs/custom_channels.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cogs/custom_channels.py b/cogs/custom_channels.py index a822f0f..e1dca7d 100644 --- a/cogs/custom_channels.py +++ b/cogs/custom_channels.py @@ -1,4 +1,5 @@ from discord import ApplicationContext, Embed, option +from discord.abc import GuildChannel from discord import utils as ds_utils from discord.commands import SlashCommandGroup from discord.ext import commands @@ -7,12 +8,18 @@ from classes.holo_user import HoloUser from enums.colors import Color from modules.utils import config_get from modules.utils_sync import config_get_sync, guild_name +from modules.database import col_users class CustomChannels(commands.Cog): def __init__(self, client): self.client = client + @commands.Cog.listener() + async def on_guild_channel_delete(self, channel: GuildChannel): + col_users.find_one_and_update({"customchannel": channel.id}, {"$set": {"customchannel": None}}) + + customchannel = SlashCommandGroup("customchannel", "Керування особистим каналом") @customchannel.command(