Add Pterodactyl cog #19

Merged
cswimr merged 139 commits from pterodactyl into main 2024-03-02 00:07:42 -05:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 882b0386f2 - Show all commits

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)