From 1ff240706c98d8c7888a226405dfbc689dc43873 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Tue, 2 Jan 2024 03:40:35 -0500 Subject: [PATCH] fix(aurora): discriminators will only be shown if the user is on the legacy username system --- aurora/aurora.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aurora/aurora.py b/aurora/aurora.py index 3fd6345..e3cd482 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -967,6 +967,7 @@ class Aurora(commands.Cog): num = 0 for target_id, moderation_id in zip(target_ids, moderation_ids): user: discord.User = await self.bot.fetch_user(target_id) + name = f"{user.name}#{user.discriminator}" if user.discriminator != "0" else user.name try: await guild.unban(user, reason=f"Automatic unban from case #{moderation_id}") @@ -977,10 +978,10 @@ class Aurora(commands.Cog): except discord.errors.HTTPException: pass - logger.debug("Unbanned %s#%s (%s) from %s (%s)", user.name, user.discriminator, user.id, guild.name, guild.id) + logger.debug("Unbanned %s (%s) from %s (%s)", name, user.id, guild.name, guild.id) num = num + 1 except (discord.errors.NotFound, discord.errors.Forbidden, discord.errors.HTTPException) as e: - logger.error("Failed to unban %s#%s (%s) from %s (%s)\n%s", user.name, user.discriminator, user.id, guild.name, guild.id, e) + logger.error("Failed to unban %s (%s) from %s (%s)\n%s", name, user.id, guild.name, guild.id, e) expiry_query = f"UPDATE `moderation_{guild.id}` SET expired = 1 WHERE (end_timestamp != 0 AND end_timestamp <= ? AND expired = 0 AND moderation_type != 'BLACKLIST') OR (expired = 0 AND resolved = 1 AND moderation_type != 'BLACKLIST')" cursor.execute(expiry_query, (time.time(),))