modified formatting of config messages

This commit is contained in:
Seaswimmer 2023-07-15 13:22:10 -04:00
parent 9186b42837
commit 9f8fd0c376
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -198,17 +198,17 @@ class Pterodactyl(commands.Cog):
message = "" message = ""
if self.base_url.value != "": if self.base_url.value != "":
await self.config.guild(interaction.guild).base_url.set(self.base_url.value) await self.config.guild(interaction.guild).base_url.set(self.base_url.value)
message += f"- Base URL set to `{self.base_url.value}`\n" message += f"- Base URL set to\n - `{self.base_url.value}`\n"
if self.api_key.value != "": if self.api_key.value != "":
await self.config.guild(interaction.guild).api_key.set(self.api_key.value) await self.config.guild(interaction.guild).api_key.set(self.api_key.value)
trimmed_api_key = self.api_key.value[:16] + "`..." trimmed_api_key = self.api_key.value[:16]
message += f"- API Key set to `{trimmed_api_key}\n" message += f"- API Key set to\n - `{trimmed_api_key}` - Trimmed for security\n"
if self.server_id.value != "": if self.server_id.value != "":
await self.config.guild(interaction.guild).server_id.set(self.server_id.value) await self.config.guild(interaction.guild).server_id.set(self.server_id.value)
message += f"- Server ID set to `{self.server_id.value}`\n" message += f"- Server ID set to\n - `{self.server_id.value}`\n"
if message == "": if message == "":
trimmed_api_key = str(await self.config.guild(interaction.guild).api_key())[:16] + "`..." trimmed_api_key = str(await self.config.guild(interaction.guild).api_key())[:16] + "`..."
send = f"No changes were made.\nCurrent configuration:\n- Base URL: `{await self.config.guild(interaction.guild).base_url()}`\n- API Key: `{trimmed_api_key}\n- Server ID: `{await self.config.guild(interaction.guild).server_id()}`" send = f"No changes were made.\nCurrent configuration:\n- Base URL:\n - `{await self.config.guild(interaction.guild).base_url()}`\n- API Key:\n - `{trimmed_api_key}` - Trimmed for security\n- Server ID:\n - `{await self.config.guild(interaction.guild).server_id()}`"
else: else:
send = f"Configuration changed:\n{message}" send = f"Configuration changed:\n{message}"
await interaction.response.send_message(send, ephemeral=True) await interaction.response.send_message(send, ephemeral=True)
@ -236,7 +236,7 @@ class Pterodactyl(commands.Cog):
message = "" message = ""
if self.startup_jar.value != "": if self.startup_jar.value != "":
await self.config.guild(interaction.guild).startup_jar.set(self.startup_jar.value) await self.config.guild(interaction.guild).startup_jar.set(self.startup_jar.value)
message += f"- Startup jar set to `{self.startup_jar.value}`\n" message += f"- Startup jar set to\n - `{self.startup_jar.value}`\n"
if self.startup_arguments.value != "": if self.startup_arguments.value != "":
await self.config.guild(interaction.guild).startup_arguments.set(self.startup_arguments.value) await self.config.guild(interaction.guild).startup_arguments.set(self.startup_arguments.value)
message += f"- Startup arguments set to:\n```{self.startup_arguments.value}```\n" message += f"- Startup arguments set to:\n```{self.startup_arguments.value}```\n"