Changed discord.utils import

This commit is contained in:
Profitroll 2023-05-06 15:21:15 +02:00
parent 7946b79918
commit 22a19c27f8

View File

@ -1,6 +1,8 @@
from discord import ApplicationContext, option, utils, Embed from discord import ApplicationContext, Embed, option
from discord.ext import commands from discord import utils as ds_utils
from discord.commands import SlashCommandGroup from discord.commands import SlashCommandGroup
from discord.ext import commands
from classes.holo_user import HoloUser 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
@ -31,7 +33,7 @@ class CustomChannels(commands.Cog):
created_channel = await ctx.user.guild.create_text_channel( created_channel = await ctx.user.guild.create_text_channel(
name=name, name=name,
reason=f"Користувач {guild_name(ctx.user)} купив канал", reason=f"Користувач {guild_name(ctx.user)} купив канал",
category=utils.get( category=ds_utils.get(
ctx.author.guild.categories, ctx.author.guild.categories,
id=await config_get("customchannels", "categories"), id=await config_get("customchannels", "categories"),
), ),
@ -62,7 +64,7 @@ class CustomChannels(commands.Cog):
bots = await config_get("bots") bots = await config_get("bots")
for bot in bots: for bot in bots:
await created_channel.set_permissions( await created_channel.set_permissions(
utils.get(ctx.user.guild.roles, id=bots[bot]["role"]), ds_utils.get(ctx.user.guild.roles, id=bots[bot]["role"]),
view_channel=False, view_channel=False,
) )
else: else:
@ -88,7 +90,7 @@ class CustomChannels(commands.Cog):
): ):
holo_user_ctx = HoloUser(ctx.user) holo_user_ctx = HoloUser(ctx.user)
custom_channel = 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: if custom_channel is None:
await ctx.respond( await ctx.respond(
embed=Embed( embed=Embed(
@ -124,7 +126,7 @@ class CustomChannels(commands.Cog):
if holo_user_ctx.customchannel is not None: if holo_user_ctx.customchannel is not None:
await ctx.defer() await ctx.defer()
custom_channel = utils.get( custom_channel = ds_utils.get(
ctx.guild.channels, id=holo_user_ctx.customchannel ctx.guild.channels, id=holo_user_ctx.customchannel
) )
if custom_channel is None: if custom_channel is None: