fix(pterodactyl): pylint fixes
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s

This commit is contained in:
Seaswimmer 2024-03-01 23:43:46 -05:00
parent 45797361a6
commit 882b0386f2
Signed by: cswimr
GPG key ID: B8953EC01E5C4063
2 changed files with 6 additions and 6 deletions

View file

@ -118,7 +118,7 @@ class Pterodactyl(commands.Cog):
current_status = await config.current_status()
if current_status == "running":
return await ctx.send("Server is already running.")
elif current_status in ["starting", "stopping"]:
if current_status in ["starting", "stopping"]:
return await ctx.send("Another power action is already in progress.")
message = await ctx.send("Sending websocket command to start server...")
await self.websocket.send(json.dumps({"event": "set state", "args": ["start"]}))
@ -130,7 +130,7 @@ class Pterodactyl(commands.Cog):
current_status = await config.current_status()
if current_status == "stopped":
return await ctx.send("Server is already stopped.")
elif current_status in ["starting", "stopping"]:
if current_status in ["starting", "stopping"]:
return await ctx.send("Another power action is already in progress.")
message = await ctx.send("Sending websocket command to stop server...")
await self.websocket.send(json.dumps({"event": "set state", "args": ["stop"]}))
@ -325,6 +325,6 @@ class Pterodactyl(commands.Cog):
**Achievement Regex:** {box(achievement_regex, 're')}"""
await ctx.send(embed=embed)
def get_bool_str(self, bool: bool) -> str:
def get_bool_str(self, inp: bool) -> str:
"""Return a string representation of a boolean."""
return "Enabled" if bool else "Disabled"
return "Enabled" if inp else "Disabled"

View file

@ -254,8 +254,8 @@ async def generate_achievement_embed(username: str, achievement: str, challenge:
return embed
def mask_ip(string: str) -> str:
def mask_ip(match):
def check(match):
ip = match.group(0)
masked_ip = '.'.join(r'\*' * len(octet) for octet in ip.split('.'))
return masked_ip
return re.sub(r'\b(?:\d{1,3}\.){3}\d{1,3}\b', mask_ip, string)
return re.sub(r'\b(?:\d{1,3}\.){3}\d{1,3}\b', check, string)