Sorted, formatted, removed unused imports

This commit is contained in:
2023-05-06 18:56:01 +02:00
parent 640ab65e7a
commit 5ff49ed052
6 changed files with 49 additions and 41 deletions

View File

@@ -1,14 +1,14 @@
from discord import ApplicationContext, Embed, option
from discord.abc import GuildChannel
from discord import utils as ds_utils
from discord.abc import GuildChannel
from discord.commands import SlashCommandGroup
from discord.ext import commands
from classes.holo_user import HoloUser
from enums.colors import Color
from modules.database import col_users
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):
@@ -17,8 +17,9 @@ class CustomChannels(commands.Cog):
@commands.Cog.listener()
async def on_guild_channel_delete(self, channel: GuildChannel):
col_users.find_one_and_update({"customchannel": channel.id}, {"$set": {"customchannel": None}})
col_users.find_one_and_update(
{"customchannel": channel.id}, {"$set": {"customchannel": None}}
)
customchannel = SlashCommandGroup("customchannel", "Керування особистим каналом")
@@ -97,7 +98,9 @@ class CustomChannels(commands.Cog):
):
holo_user_ctx = HoloUser(ctx.user)
custom_channel = ds_utils.get(ctx.guild.channels, id=holo_user_ctx.customchannel)
custom_channel = ds_utils.get(
ctx.guild.channels, id=holo_user_ctx.customchannel
)
if custom_channel is None:
await ctx.respond(
embed=Embed(
@@ -129,7 +132,9 @@ class CustomChannels(commands.Cog):
guild_ids=[config_get_sync("guild")],
)
@option("confirm", description="Підтвердження операції")
async def customchannel_remove_cmd(self, ctx: ApplicationContext, confirm: bool = False):
async def customchannel_remove_cmd(
self, ctx: ApplicationContext, confirm: bool = False
):
holo_user_ctx = HoloUser(ctx.user)
if holo_user_ctx.customchannel is not None: