From 2bc10b0ddc2b7b013d66c1b2a0a1919f75099f1e Mon Sep 17 00:00:00 2001 From: i_iMikey <67828573+MikeyUsersREC@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:34:10 +0000 Subject: [PATCH] PRC Integration Act 5 --- cogs/Configuration.py | 4 ++-- cogs/Punishments.py | 2 +- erm.py | 16 +++++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/cogs/Configuration.py b/cogs/Configuration.py index 6ce9f5b8..190172ec 100644 --- a/cogs/Configuration.py +++ b/cogs/Configuration.py @@ -846,9 +846,9 @@ async def _config(self, ctx: commands.Context): color=blank_color, description=( "**What is the ER:LC Integration?** ER:LC Integration allows for ERM to communicate with the Police Roleplay Community APIs, and your Emergency Response: Liberty County server. In particular, these configurations allow for Join Logs, Leave Logs, and Kill Logs to be logged.\n\n" - "**Elevation Required:** This setting dictates whether elevated permissions are required to run commands such as `:admin` and `:unadmin`. In such case where this is enabled, Co-Owner permissions are required to run these commands to prevent secuerity risk. If disabled, those with the Management Roles in your server can run these commands. **It is advised you keep this enabled unless you have a valid reason to turn it off.** Contact ERM Support if you are unsure what this setting does.\n\n" + "**Elevation Required:** This setting dictates whether elevated permissions are required to run commands such as `:admin` and `:unadmin`. In such case where this is enabled, Co-Owner permissions are required to run these commands to prevent security risk. If disabled, those with the Management Roles in your server can run these commands. **It is advised you keep this enabled unless you have a valid reason to turn it off.** Contact ERM Support if you are unsure what this setting does.\n\n" "**Player Logs Channel:** This channel is where Player Join and Leave logs will be sent by ERM. ERM will check your server every 45 seconds to see if new members have joined or left, and report of their time accordingly.\n\n" - "**Kill Logs Channel:** This setting is where Kill Logs will be sent by ERM. ERM will check your server every 45 servers and constantly contact your ER:LC private server to know if there are any new kill logs. If there are, to log them in the corresponding channel." + "**Kill Logs Channel:** This setting is where Kill Logs will be sent by ERM. ERM will check your server every 45 seconds and constantly contact your ER:LC private server to know if there are any new kill logs. If there are, to log them in the corresponding channel." ) ) ] diff --git a/cogs/Punishments.py b/cogs/Punishments.py index c21548b3..5d4bbd1b 100644 --- a/cogs/Punishments.py +++ b/cogs/Punishments.py @@ -601,7 +601,7 @@ async def task(interaction: discord.Interaction, _): doc["UserID"], doc["Username"], ctx.guild.id, - f"BOLO marked as complete by {ctx.author} ({ctx.author.id}). Original BOLO Reason was {doc['Reason']}", + f"BOLO marked as complete by {ctx.author} ({ctx.author.id}). Original BOLO Reason was {doc['Reason']} made by {doc['Moderator']} ({doc["ModeratorID"]})", "Ban", datetime.datetime.now(tz=pytz.UTC).timestamp(), ) diff --git a/erm.py b/erm.py index c5b878a6..ce12f080 100644 --- a/erm.py +++ b/erm.py @@ -586,6 +586,8 @@ async def iterate_prc_logs(): guild = await bot.fetch_guild(item['_id']) except discord.HTTPException: continue + if guild is None: + continue try: kill_logs_channel = await guild.fetch_channel(item['ERLC'].get('kill_logs')) @@ -608,8 +610,10 @@ async def iterate_prc_logs(): player_logs: list[prc_api.JoinLeaveLog] = await bot.prc_api.fetch_player_logs(guild.id) except prc_api.ResponseFailure as e: channel = await bot.fetch_channel(1213523576603410452) - await channel.send(content=str(e) or repr(e)) - capture_exception(e) + await channel.send(content=f"[1] {(str(e) or repr(e))=}") + with push_scope() as scope: + scope.level = "error" + capture_exception(e) if int(e.status_code) == 403: # This means the key is most likely banned or revoked. await bot.server_keys.delete_by_id(guild.id) @@ -753,7 +757,7 @@ async def iterate_prc_logs(): roblox_to_discord = {} t1 = time.time() for item in perm_staff: - roblox_to_discord[int(((await bot.bloxlink.find_roblox(item.id)) or {}).get('robloxID'))] = item + roblox_to_discord[int(((await bot.bloxlink.find_roblox(item.id)) or {}).get('robloxID') or "0")] = item t2 = time.time() logging.debug('Total staff account indexing: {}'.format(t2 - t1)) @@ -785,8 +789,10 @@ async def iterate_prc_logs(): ) except Exception as error: channel = await bot.fetch_channel(1213523576603410452) - await channel.send(content=str(error)) - + await channel.send(content=f"[2] {str(error)=}") + with push_scope() as scope: + scope.level = "error" + capture_exception(error) @iterate_prc_logs.before_loop async def anti_fetch_measure():