feat(pterodactyl): added user join/leave
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s

This commit is contained in:
SeaswimmerTheFsh 2024-03-01 00:23:00 -05:00
parent 7a39c9a75d
commit 2fbd8cde9e
Signed by: cswimr
GPG key ID: B8953EC01E5C4063
3 changed files with 89 additions and 14 deletions

View file

@ -130,18 +130,6 @@ class Pterodactyl(commands.Cog):
await config.chat_channel.set(channel.id)
await ctx.send(f"Chat channel set to {channel.mention}")
@pterodactyl_config_chat.command(name = "regex")
async def pterodactyl_config_chat_regex(self, ctx: commands.Context, *, regex: str = None) -> None:
"""Set the regex pattern to match chat messages on the server.
See [documentation]() for more information."""
#TODO - fix this link
if regex is None:
regex = await config.chat_regex()
return await ctx.send(f"Chat regex is currently set to:\n{box(regex, 'regex')}")
await config.chat_regex.set(regex)
await ctx.send(f"Chat regex set to:\n{box(regex, 'regex')}")
@pterodactyl_config_chat.command(name = "command")
async def pterodactyl_config_chat_command(self, ctx: commands.Context, *, command: str = None) -> None:
"""Set the command that will be used to send messages from Discord.
@ -155,8 +143,24 @@ class Pterodactyl(commands.Cog):
await config.chat_command.set(command)
await ctx.send(f"Chat command set to:\n{box(command, 'json')}")
@pterodactyl_config_chat.command(name = "server")
async def pterodactyl_config_chat_server(self, ctx: commands.Context, *, regex: str = None) -> None:
@pterodactyl_config.group(name = "regex")
async def pterodactyl_config_regex(self, ctx: commands.Context) -> None:
"""Set regex patterns."""
@pterodactyl_config_regex.command(name = "chat")
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.
See [documentation]() for more information."""
#TODO - fix this link
if regex is None:
regex = await config.chat_regex()
return await ctx.send(f"Chat regex is currently set to:\n{box(regex, 'regex')}")
await config.chat_regex.set(regex)
await ctx.send(f"Chat regex set to:\n{box(regex, 'regex')}")
@pterodactyl_config_regex.command(name = "server")
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.
See [documentation]() for more information."""
@ -188,3 +192,21 @@ class Pterodactyl(commands.Cog):
return await ctx.send(f"Shutdown message is currently set to: {message}")
await config.shutdown_msg.set(message)
await ctx.send(f"Shutdown message set to: {message}")
@pterodactyl_config_messages.command(name = "join")
async def pterodactyl_config_messages_join(self, ctx: commands.Context, *, message: str = None) -> None:
"""Set the message that will be sent when a user joins the server. This is only shown in embeds."""
if message is None:
message = await config.join_msg()
return await ctx.send(f"Join message is currently set to: {message}")
await config.join_msg.set(message)
await ctx.send(f"Join message set to: {message}")
@pterodactyl_config_messages.command(name = "leave")
async def pterodactyl_config_messages_leave(self, ctx: commands.Context, *, message: str = None) -> None:
"""Set the message that will be sent when a user leaves the server. This is only shown in embeds."""
if message is None:
message = await config.leave_msg()
return await ctx.send(f"Leave message is currently set to: {message}")
await config.leave_msg.set(message)
await ctx.send(f"Leave message set to: {message}")