fix(aurora): adding some more logging to the expiry task
This commit is contained in:
parent
bcef643349
commit
877f5e00d3
1 changed files with 11 additions and 14 deletions
|
@ -1694,13 +1694,8 @@ class Aurora(commands.Cog):
|
||||||
try:
|
try:
|
||||||
member = await guild.fetch_member(target_id)
|
member = await guild.fetch_member(target_id)
|
||||||
|
|
||||||
role = guild.get_role(role_id)
|
|
||||||
if role is None:
|
|
||||||
logger.warning("Role %s does not exist in %s, unable to remove role from user %s", role_id, guild.id, target_id)
|
|
||||||
continue
|
|
||||||
|
|
||||||
await member.remove_roles(
|
await member.remove_roles(
|
||||||
role, reason=f"Automatic role removal from case #{moderation_id}"
|
role_id, reason=f"Automatic role removal from case #{moderation_id}"
|
||||||
)
|
)
|
||||||
|
|
||||||
removerole_num = removerole_num + 1
|
removerole_num = removerole_num + 1
|
||||||
|
@ -1708,7 +1703,13 @@ class Aurora(commands.Cog):
|
||||||
discord.errors.NotFound,
|
discord.errors.NotFound,
|
||||||
discord.errors.Forbidden,
|
discord.errors.Forbidden,
|
||||||
discord.errors.HTTPException,
|
discord.errors.HTTPException,
|
||||||
):
|
) as e:
|
||||||
|
logger.error(
|
||||||
|
"Removing the role %s from user %s failed due to: \n%s",
|
||||||
|
role_id,
|
||||||
|
target_id,
|
||||||
|
e,
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
addrole_num = 0
|
addrole_num = 0
|
||||||
|
@ -1728,13 +1729,8 @@ class Aurora(commands.Cog):
|
||||||
try:
|
try:
|
||||||
member = await guild.fetch_member(target_id)
|
member = await guild.fetch_member(target_id)
|
||||||
|
|
||||||
role = guild.get_role(role_id)
|
|
||||||
if role is None:
|
|
||||||
logger.warning("Role %s does not exist in %s, unable to add role to user %s", role_id, guild.id, target_id)
|
|
||||||
continue
|
|
||||||
|
|
||||||
await member.add_roles(
|
await member.add_roles(
|
||||||
role, reason=f"Automatic role addition from case #{moderation_id}"
|
role_id, reason=f"Automatic role addition from case #{moderation_id}"
|
||||||
)
|
)
|
||||||
|
|
||||||
addrole_num = addrole_num + 1
|
addrole_num = addrole_num + 1
|
||||||
|
@ -1742,7 +1738,8 @@ class Aurora(commands.Cog):
|
||||||
discord.errors.NotFound,
|
discord.errors.NotFound,
|
||||||
discord.errors.Forbidden,
|
discord.errors.Forbidden,
|
||||||
discord.errors.HTTPException,
|
discord.errors.HTTPException,
|
||||||
):
|
) as e:
|
||||||
|
logger.error("Adding the role %s to user %s failed due to: \n%s", role_id, target_id, e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
expiry_query = f"UPDATE `moderation_{guild.id}` SET expired = 1 WHERE (end_timestamp != 0 AND end_timestamp <= ? AND expired = 0) OR (expired = 0 AND resolved = 1);"
|
expiry_query = f"UPDATE `moderation_{guild.id}` SET expired = 1 WHERE (end_timestamp != 0 AND end_timestamp <= ? AND expired = 0) OR (expired = 0 AND resolved = 1);"
|
||||||
|
|
Loading…
Reference in a new issue