feat(pterodactyl): added [p]pterodactyl config view
command
This commit is contained in:
parent
f93223fd36
commit
987a29afff
1 changed files with 53 additions and 0 deletions
|
@ -312,3 +312,56 @@ class Pterodactyl(commands.Cog):
|
||||||
return await ctx.send(f"IP masking is currently set to {mask}")
|
return await ctx.send(f"IP masking is currently set to {mask}")
|
||||||
await config.mask_ip.set(mask)
|
await config.mask_ip.set(mask)
|
||||||
await ctx.send(f"IP masking set to {mask}")
|
await ctx.send(f"IP masking set to {mask}")
|
||||||
|
|
||||||
|
@pterodactyl_config.command(name = "api")
|
||||||
|
async def pterodactyl_config_api(self, ctx: commands.Context, endpoint: str = None) -> None:
|
||||||
|
"""Set the API endpoint to use for the user retrival API.
|
||||||
|
|
||||||
|
This is only used for retrieving user avatars for webhook messages."""
|
||||||
|
if endpoint is None:
|
||||||
|
endpoint = await config.api_endpoint()
|
||||||
|
return await ctx.send(f"API endpoint is currently set to {endpoint}")
|
||||||
|
await config.api_endpoint.set(endpoint)
|
||||||
|
await ctx.send(f"API endpoint set to {endpoint}")
|
||||||
|
|
||||||
|
@pterodactyl_config.command(name = 'view', aliases = ['show'])
|
||||||
|
async def pterodactyl_config_view(self, ctx: commands.Context) -> None:
|
||||||
|
"""View the current configuration."""
|
||||||
|
base_url = await config.base_url()
|
||||||
|
server_id = await config.server_id()
|
||||||
|
console_channel = await config.console_channel()
|
||||||
|
chat_channel = await config.chat_channel()
|
||||||
|
chat_command = await config.chat_command()
|
||||||
|
chat_regex = await config.chat_regex()
|
||||||
|
server_regex = await config.server_regex()
|
||||||
|
join_regex = await config.join_regex()
|
||||||
|
leave_regex = await config.leave_regex()
|
||||||
|
achievement_regex = await config.achievement_regex()
|
||||||
|
startup_msg = await config.startup_msg()
|
||||||
|
shutdown_msg = await config.shutdown_msg()
|
||||||
|
join_msg = await config.join_msg()
|
||||||
|
leave_msg = await config.leave_msg()
|
||||||
|
mask_ip = await config.mask_ip()
|
||||||
|
api_endpoint = await config.api_endpoint()
|
||||||
|
embed = discord.Embed(color = await ctx.embed_color(), title="Pterodactyl Configuration")
|
||||||
|
embed.description = f"""**Base URL:** {base_url}
|
||||||
|
**Server ID:** `{server_id}`
|
||||||
|
**Console Channel:** {console_channel}
|
||||||
|
**Chat Channel:** {chat_channel}
|
||||||
|
**Chat Command:** {box(chat_command, 'json')}
|
||||||
|
**Chat Regex:** `{chat_regex}`
|
||||||
|
**Server Regex:** `{server_regex}`
|
||||||
|
**Join Regex:** `{join_regex}`
|
||||||
|
**Leave Regex:** `{leave_regex}`
|
||||||
|
**Achievement Regex:** `{achievement_regex}`
|
||||||
|
**Startup Message:** {startup_msg}
|
||||||
|
**Shutdown Message:** {shutdown_msg}
|
||||||
|
**Join Message:** {join_msg}
|
||||||
|
**Leave Message:** {leave_msg}
|
||||||
|
**Mask IP:** {self.get_bool_str(mask_ip)}
|
||||||
|
**API Endpoint:** `{api_endpoint}`"""
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
def get_bool_str(self, bool: bool) -> str:
|
||||||
|
"""Return a string representation of a boolean."""
|
||||||
|
return "Enabled" if bool else "Disabled"
|
||||||
|
|
Loading…
Reference in a new issue