Skip to content

Commit

Permalink
Fixing issues with /erlc playerlogs and /erlc kills
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeyUsersREC committed Mar 5, 2024
1 parent 144147e commit 596bbb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
20 changes: 0 additions & 20 deletions cogs/ERLC.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,8 @@ async def operate_and_reload_kills(msg, guild_id: str):

sorted_kill_logs = sorted(kill_logs, key=lambda log: log.timestamp, reverse=True)
for log in sorted_kill_logs:
if len(embed.description) >= 4000:
new = '\n'.join(embed.description.splitlines())
embed.description = new
break
embed.description += f"> [{log.killer_username}](https://roblox.com/users/{log.killer_user_id}/profile) killed [{log.killed_username}](https://roblox.com/users/{log.killed_user_id}/profile) • <t:{int(log.timestamp)}:R>\n"


lines = [*[line for index, line in enumerate(embed.description.split('\n')) if index != len(embed.description.splitlines()) -1]]
embed.description = '\n'.join(lines)
if embed.description in ['', '\n']:
embed.description = "> No kill logs found."

Expand Down Expand Up @@ -397,15 +390,9 @@ async def operate_and_reload_playerlogs(msg, guild_id: str):

sorted_logs = sorted(player_logs, key=lambda log: log.timestamp, reverse=True)
for log in sorted_logs:
if len(embed.description) >= 4000:
new = '\n'.join(embed.description.splitlines())
embed.description = new
break
embed.description += f"> [{log.username}](https://roblox.com/users/{log.user_id}/profile) {'joined the server' if log.type == 'join' else 'left the server'} • <t:{int(log.timestamp)}:R>\n"


lines = [*[line for index, line in enumerate(embed.description.split('\n')) if index != len(embed.description.splitlines()) -1]]
embed.description = '\n'.join(lines)
if embed.description in ['', '\n']:
embed.description = "> No player logs found."

Expand Down Expand Up @@ -448,15 +435,8 @@ async def operate_and_reload_commandlogs(msg, guild_id: str):

sorted_logs = sorted(command_logs, key=lambda log: log.timestamp, reverse=True)
for log in sorted_logs:
if len(embed.description) >= 4000:
new = '\n'.join(embed.description.splitlines())
embed.description = new
break
embed.description += f"> [{log.username}](https://roblox.com/users/{log.user_id}/profile) ran the command `{log.command}` • <t:{int(log.timestamp)}:R>\n"


lines = [*[line for index, line in enumerate(embed.description.split('\n')) if index != len(embed.description.splitlines()) -1]]
embed.description = '\n'.join(lines)
if embed.description in ['', '\n']:
embed.description = "> No player logs found."

Expand Down
6 changes: 5 additions & 1 deletion erm.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,11 @@ async def tempban_checks():
continue

if not cached_servers.get(punishment_item['Guild']):
cached_servers[punishment_item['Guild']] = await bot.prc_api.fetch_bans(punishment_item['Guild'])
try:
cached_servers[punishment_item['Guild']] = await bot.prc_api.fetch_bans(punishment_item['Guild'])
except:
continue


punishment_item['CheckExecuted'] = True
await bot.punishments.update_by_id(punishment_item)
Expand Down

0 comments on commit 596bbb9

Please sign in to comment.