WIP: Database migrations
This commit is contained in:
@@ -25,7 +25,7 @@ class CustomChannels(commands.Cog):
|
||||
@commands.Cog.listener()
|
||||
async def on_guild_channel_delete(self, channel: GuildChannel) -> None:
|
||||
await col_users.find_one_and_update(
|
||||
{"customchannel": channel.id}, {"$set": {"customchannel": None}}
|
||||
{"custom_channel": channel.id}, {"$set": {"custom_channel": None}}
|
||||
)
|
||||
|
||||
custom_channel_group: SlashCommandGroup = SlashCommandGroup(
|
||||
@@ -47,7 +47,7 @@ class CustomChannels(commands.Cog):
|
||||
|
||||
Command to create a custom channel for a user.
|
||||
"""
|
||||
holo_user_ctx: HoloUser = HoloUser(ctx.user)
|
||||
holo_user_ctx: HoloUser = await HoloUser.from_user(ctx.user)
|
||||
|
||||
# Return if the user is using the command outside of a guild
|
||||
if not hasattr(ctx.author, "guild"):
|
||||
@@ -62,7 +62,7 @@ class CustomChannels(commands.Cog):
|
||||
return
|
||||
|
||||
# Return if the user already has a custom channel
|
||||
if holo_user_ctx.customchannel is not None:
|
||||
if holo_user_ctx.custom_channel is not None:
|
||||
await ctx.defer(ephemeral=True)
|
||||
await ctx.respond(
|
||||
embed=Embed(
|
||||
@@ -80,7 +80,7 @@ class CustomChannels(commands.Cog):
|
||||
reason=f"Користувач {guild_name(ctx.user)} отримав власний приватний канал",
|
||||
category=ds_utils.get(
|
||||
ctx.author.guild.categories,
|
||||
id=await config_get("customchannels", "categories"),
|
||||
id=await config_get("custom_channels", "categories"),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -100,7 +100,7 @@ class CustomChannels(commands.Cog):
|
||||
manage_channels=True,
|
||||
)
|
||||
|
||||
await holo_user_ctx.set("customchannel", created_channel.id)
|
||||
await holo_user_ctx.set_custom_channel(created_channel.id)
|
||||
|
||||
await ctx.respond(
|
||||
embed=Embed(
|
||||
@@ -136,10 +136,10 @@ class CustomChannels(commands.Cog):
|
||||
|
||||
Command to change properties of a custom channel.
|
||||
"""
|
||||
holo_user_ctx: HoloUser = HoloUser(ctx.user)
|
||||
holo_user_ctx: HoloUser = await HoloUser.from_user(ctx.user)
|
||||
|
||||
custom_channel: TextChannel | None = ds_utils.get(
|
||||
ctx.guild.channels, id=holo_user_ctx.customchannel
|
||||
ctx.guild.channels, id=holo_user_ctx.custom_channel
|
||||
)
|
||||
|
||||
# Return if the channel was not found
|
||||
@@ -182,10 +182,10 @@ class CustomChannels(commands.Cog):
|
||||
"""Command /customchannel remove [<confirm>]
|
||||
|
||||
Command to remove a custom channel. Requires additional confirmation."""
|
||||
holo_user_ctx: HoloUser = HoloUser(ctx.user)
|
||||
holo_user_ctx: HoloUser = await HoloUser.from_user(ctx.user)
|
||||
|
||||
# Return if the user does not have a custom channel
|
||||
if holo_user_ctx.customchannel is None:
|
||||
if holo_user_ctx.custom_channel is None:
|
||||
await ctx.defer(ephemeral=True)
|
||||
await ctx.respond(
|
||||
embed=Embed(
|
||||
@@ -199,7 +199,7 @@ class CustomChannels(commands.Cog):
|
||||
await ctx.defer()
|
||||
|
||||
custom_channel: TextChannel | None = ds_utils.get(
|
||||
ctx.guild.channels, id=holo_user_ctx.customchannel
|
||||
ctx.guild.channels, id=holo_user_ctx.custom_channel
|
||||
)
|
||||
|
||||
# Return if the channel was not found
|
||||
@@ -211,7 +211,7 @@ class CustomChannels(commands.Cog):
|
||||
color=Color.FAIL,
|
||||
)
|
||||
)
|
||||
await holo_user_ctx.set("customchannel", None)
|
||||
await holo_user_ctx.remove_custom_channel()
|
||||
return
|
||||
|
||||
# Return if the confirmation is missing
|
||||
@@ -227,7 +227,7 @@ class CustomChannels(commands.Cog):
|
||||
|
||||
await custom_channel.delete(reason="Власник запросив видалення")
|
||||
|
||||
await holo_user_ctx.set("customchannel", None)
|
||||
await holo_user_ctx.remove_custom_channel()
|
||||
|
||||
try:
|
||||
await ctx.respond(
|
||||
|
Reference in New Issue
Block a user