Fixed unexpected behavior

This commit is contained in:
Profitroll 2023-05-06 18:31:07 +02:00
parent 89bb57b2fc
commit f9a8d6ddf6

View File

@ -1,4 +1,5 @@
from discord import ApplicationContext, Embed, option from discord import ApplicationContext, Embed, option
from discord.abc import GuildChannel
from discord import utils as ds_utils from discord import utils as ds_utils
from discord.commands import SlashCommandGroup from discord.commands import SlashCommandGroup
from discord.ext import commands from discord.ext import commands
@ -7,12 +8,18 @@ from classes.holo_user import HoloUser
from enums.colors import Color from enums.colors import Color
from modules.utils import config_get from modules.utils import config_get
from modules.utils_sync import config_get_sync, guild_name from modules.utils_sync import config_get_sync, guild_name
from modules.database import col_users
class CustomChannels(commands.Cog): class CustomChannels(commands.Cog):
def __init__(self, client): def __init__(self, client):
self.client = 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 = SlashCommandGroup("customchannel", "Керування особистим каналом")
@customchannel.command( @customchannel.command(