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(