Skip to content

Commit

Permalink
PRC Integration Act 5
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeyUsersREC committed Mar 5, 2024
1 parent 272f85f commit 2bc10b0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cogs/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)
)
]
Expand Down
2 changes: 1 addition & 1 deletion cogs/Punishments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Expand Down
16 changes: 11 additions & 5 deletions erm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand All @@ -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)
Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 2bc10b0

Please sign in to comment.