Working on #14

This commit is contained in:
kku
2024-12-16 16:25:35 +01:00
parent 41112018da
commit 454ce2b6fb
7 changed files with 62 additions and 50 deletions

View File

@@ -46,7 +46,7 @@ class Analytics(commands.Cog):
}
)
col_analytics.insert_one(
await col_analytics.insert_one(
{
"user": message.author.id,
"channel": message.channel.id,

View File

@@ -19,7 +19,7 @@ class CustomChannels(commands.Cog):
@commands.Cog.listener()
async def on_guild_channel_delete(self, channel: GuildChannel):
col_users.find_one_and_update(
await col_users.find_one_and_update(
{"customchannel": channel.id}, {"$set": {"customchannel": None}}
)
@@ -77,7 +77,7 @@ class CustomChannels(commands.Cog):
manage_channels=True,
)
holo_user_ctx.set("customchannel", created_channel.id)
await holo_user_ctx.set("customchannel", created_channel.id)
await ctx.respond(
embed=Embed(
@@ -178,7 +178,7 @@ class CustomChannels(commands.Cog):
color=Color.fail,
)
)
holo_user_ctx.set("customchannel", None)
await holo_user_ctx.set("customchannel", None)
return
# Return if the confirmation is missing
@@ -194,7 +194,7 @@ class CustomChannels(commands.Cog):
await custom_channel.delete(reason="Власник запросив видалення")
holo_user_ctx.set("customchannel", None)
await holo_user_ctx.set("customchannel", None)
await ctx.respond(
embed=Embed(

View File

@@ -40,7 +40,7 @@ class Data(commands.Cog):
# Return if the user is not an owner and not in the council
if (ctx.user.id not in self.client.owner_ids) and not (
await holo_user.is_council(ctx.author)
await HoloUser.is_council(ctx.author)
):
logging.info(
"User %s tried to use /export but permission denied",
@@ -108,11 +108,9 @@ class Data(commands.Cog):
async def data_migrate_cmd(self, ctx: ApplicationContext, kind: str):
await ctx.defer()
holo_user = HoloUser(ctx.author)
# Return if the user is not an owner and not in the council
if (ctx.user.id not in self.client.owner_ids) and not (
await holo_user.is_council(ctx.author)
await HoloUser.is_council(ctx.author)
):
logging.info(
"User %s tried to use /migrate but permission denied",
@@ -156,7 +154,7 @@ class Data(commands.Cog):
if member.bot:
continue
if col_users.find_one({"user": member.id}) is None:
if (await col_users.find_one({"user": member.id})) is None:
user = {}
defaults = await config_get("user", "defaults")
@@ -165,7 +163,7 @@ class Data(commands.Cog):
for key in defaults:
user[key] = defaults[key]
col_users.insert_one(document=user)
await col_users.insert_one(document=user)
logging.info(
"Added DB record for user %s during migration", member.id

View File

@@ -18,7 +18,7 @@ class Logger(commands.Cog):
and (message.author.bot is False)
and (message.author.system is False)
):
if col_users.find_one({"user": message.author.id}) is None:
if (await col_users.find_one({"user": message.author.id})) is None:
user = {}
defaults = await config_get("user", "defaults")
@@ -27,7 +27,7 @@ class Logger(commands.Cog):
for key in defaults:
user[key] = defaults[key]
col_users.insert_one(document=user)
await col_users.insert_one(document=user)
@commands.Cog.listener()
async def on_member_join(self, member: Member):
@@ -51,7 +51,7 @@ class Logger(commands.Cog):
)
)
if col_users.find_one({"user": member.id}) is None:
if (await col_users.find_one({"user": member.id})) is None:
user = {}
defaults = await config_get("user", "defaults")
@@ -60,7 +60,7 @@ class Logger(commands.Cog):
for key in defaults:
user[key] = defaults[key]
col_users.insert_one(document=user)
await col_users.insert_one(document=user)
def setup(client: PycordBot):