fix(aurora): discriminators will only be shown if the user is on the legacy username system
All checks were successful
Pylint / Pylint (3.11) (push) Successful in 43s
All checks were successful
Pylint / Pylint (3.11) (push) Successful in 43s
This commit is contained in:
parent
78071ac475
commit
1ff240706c
1 changed files with 3 additions and 2 deletions
|
@ -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(),))
|
||||
|
|
Loading…
Reference in a new issue