Add Pterodactyl cog #19

Merged
cswimr merged 139 commits from pterodactyl into main 2024-03-02 00:07:42 -05:00
Showing only changes of commit 684f2559e2 - Show all commits

View file

@ -77,7 +77,7 @@ class Pterodactyl(commands.Cog):
return command return command
@commands.Cog.listener() @commands.Cog.listener()
async def on_red_api_tokens_update(self, service_name: str, api_tokens: Mapping[str,str]): async def on_red_api_tokens_update(self, service_name: str, api_tokens: Mapping[str,str]): # pylint: disable=unused-argument
if service_name == "pterodactyl": if service_name == "pterodactyl":
logger.info("Configuration value set: api_key\nRestarting task...") logger.info("Configuration value set: api_key\nRestarting task...")
self.task.cancel() self.task.cancel()
@ -137,8 +137,7 @@ class Pterodactyl(commands.Cog):
"""Set the command that will be used to send messages from Discord. """Set the command that will be used to send messages from Discord.
Required placeholders: `.$U` (username), `.$M` (message), `.$C` (color) Required placeholders: `.$U` (username), `.$M` (message), `.$C` (color)
See [documentation]() for more information.""" See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#changing-the-tellraw-command) for more information."""
#TODO - fix this link
if command is None: if command is None:
command = await config.chat_command() command = await config.chat_command()
return await ctx.send(f"Chat command is currently set to:\n{box(command, 'json')}") return await ctx.send(f"Chat command is currently set to:\n{box(command, 'json')}")
@ -153,8 +152,7 @@ class Pterodactyl(commands.Cog):
async def pterodactyl_config_regex_chat(self, ctx: commands.Context, *, regex: str = None) -> None: async def pterodactyl_config_regex_chat(self, ctx: commands.Context, *, regex: str = None) -> None:
"""Set the regex pattern to match chat messages on the server. """Set the regex pattern to match chat messages on the server.
See [documentation]() for more information.""" See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
#TODO - fix this link
if regex is None: if regex is None:
regex = await config.chat_regex() regex = await config.chat_regex()
return await ctx.send(f"Chat regex is currently set to:\n{box(regex, 'regex')}") return await ctx.send(f"Chat regex is currently set to:\n{box(regex, 'regex')}")
@ -165,8 +163,7 @@ class Pterodactyl(commands.Cog):
async def pterodactyl_config_regex_server(self, ctx: commands.Context, *, regex: str = None) -> None: async def pterodactyl_config_regex_server(self, ctx: commands.Context, *, regex: str = None) -> None:
"""Set the regex pattern to match server messages on the server. """Set the regex pattern to match server messages on the server.
See [documentation]() for more information.""" See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
#TODO - fix this link
if regex is None: if regex is None:
regex = await config.server_regex() regex = await config.server_regex()
return await ctx.send(f"Server regex is currently set to:\n{box(regex, 'regex')}") return await ctx.send(f"Server regex is currently set to:\n{box(regex, 'regex')}")
@ -177,8 +174,7 @@ class Pterodactyl(commands.Cog):
async def pterodactyl_config_regex_join(self, ctx: commands.Context, *, regex: str = None) -> None: async def pterodactyl_config_regex_join(self, ctx: commands.Context, *, regex: str = None) -> None:
"""Set the regex pattern to match join messages on the server. """Set the regex pattern to match join messages on the server.
See [documentation]() for more information.""" See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
#TODO - fix this link
if regex is None: if regex is None:
regex = await config.join_regex() regex = await config.join_regex()
return await ctx.send(f"Join regex is currently set to:\n{box(regex, 'regex')}") return await ctx.send(f"Join regex is currently set to:\n{box(regex, 'regex')}")
@ -189,8 +185,7 @@ class Pterodactyl(commands.Cog):
async def pterodactyl_config_regex_leave(self, ctx: commands.Context, *, regex: str = None) -> None: async def pterodactyl_config_regex_leave(self, ctx: commands.Context, *, regex: str = None) -> None:
"""Set the regex pattern to match leave messages on the server. """Set the regex pattern to match leave messages on the server.
See [documentation]() for more information.""" See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
#TODO - fix this link
if regex is None: if regex is None:
regex = await config.leave_regex() regex = await config.leave_regex()
return await ctx.send(f"Leave regex is currently set to:\n{box(regex, 'regex')}") return await ctx.send(f"Leave regex is currently set to:\n{box(regex, 'regex')}")
@ -201,8 +196,7 @@ class Pterodactyl(commands.Cog):
async def pterodactyl_config_regex_achievement(self, ctx: commands.Context, *, regex: str = None) -> None: async def pterodactyl_config_regex_achievement(self, ctx: commands.Context, *, regex: str = None) -> None:
"""Set the regex pattern to match achievement messages on the server. """Set the regex pattern to match achievement messages on the server.
See [documentation]() for more information.""" See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
#TODO - fix this link
if regex is None: if regex is None:
regex = await config.achievement_regex() regex = await config.achievement_regex()
return await ctx.send(f"Achievement regex is currently set to:\n{box(regex, 'regex')}") return await ctx.send(f"Achievement regex is currently set to:\n{box(regex, 'regex')}")