style(repo): ruff fixes
This commit is contained in:
parent
9df7f15bbe
commit
ea5f51892a
7 changed files with 39 additions and 38 deletions
|
@ -149,7 +149,7 @@ class Pterodactyl(commands.Cog):
|
|||
"P": str(response["players"]["online"]),
|
||||
"V": response["version"],
|
||||
"D": response["motd"]["clean"][0] if response["motd"]["clean"] else "unset",
|
||||
}
|
||||
},
|
||||
)
|
||||
else:
|
||||
placeholders.update(
|
||||
|
@ -159,7 +159,7 @@ class Pterodactyl(commands.Cog):
|
|||
"P": "0",
|
||||
"V": "Server Offline",
|
||||
"D": "Server Offline",
|
||||
}
|
||||
},
|
||||
)
|
||||
for key, value in placeholders.items():
|
||||
topic = topic.replace(".$" + key, value)
|
||||
|
@ -187,6 +187,7 @@ class Pterodactyl(commands.Cog):
|
|||
output_str = "\n".join(response["players"]["list"])
|
||||
return output_str, response["players"]["list"]
|
||||
return None
|
||||
return None
|
||||
|
||||
async def get_player_list_embed(self, ctx: Union[commands.Context, discord.Interaction]) -> Optional[discord.Embed]:
|
||||
player_list = await self.get_player_list()
|
||||
|
@ -220,9 +221,10 @@ class Pterodactyl(commands.Cog):
|
|||
await self.websocket.send(json.dumps({"event": "set state", "args": [action]}))
|
||||
|
||||
await message.edit(content=f"Server {action_ing}", view=None)
|
||||
return None
|
||||
|
||||
else:
|
||||
await message.edit(content="Cancelled.", view=None)
|
||||
await message.edit(content="Cancelled.", view=None)
|
||||
return None
|
||||
|
||||
async def send_command(self, ctx: Union[discord.Interaction, commands.Context], command: str):
|
||||
channel = self.bot.get_channel(await config.console_channel())
|
||||
|
|
|
@ -151,7 +151,7 @@ async def retrieve_websocket_credentials(coginstance: Pterodactyl) -> Optional[d
|
|||
Socket: %s
|
||||
Token: %s...""",
|
||||
websocket_credentials['data']['socket'],
|
||||
websocket_credentials['data']['token'][:20]
|
||||
websocket_credentials['data']['token'][:20],
|
||||
)
|
||||
return websocket_credentials
|
||||
#NOTE - The token is truncated to prevent it from being logged in its entirety, for security reasons
|
||||
|
@ -262,6 +262,5 @@ async def generate_achievement_embed(coginstance: Pterodactyl, username: str, ac
|
|||
def mask_ip(string: str) -> str:
|
||||
def check(match: re.Match[str]):
|
||||
ip = match.group(0)
|
||||
masked_ip = '.'.join(r'\*' * len(octet) for octet in ip.split('.'))
|
||||
return masked_ip
|
||||
return '.'.join(r'\*' * len(octet) for octet in ip.split('.'))
|
||||
return re.sub(r'\b(?:\d{1,3}\.){3}\d{1,3}\b', check, string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue