hopefully fixed modal

This commit is contained in:
Seaswimmer 2023-07-14 12:04:52 -04:00
parent c19508406e
commit ad8f8a65e8
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -71,17 +71,17 @@ class Pterodactyl(commands.Cog):
) )
async def on_submit(self, interaction: discord.Interaction): async def on_submit(self, interaction: discord.Interaction):
config_list = [await Pterodactyl.config.guild(interaction.guild).base_url(), await Pterodactyl.config.guild(interaction.guild).api_key(), await Pterodactyl.config.guild(interaction.guild).server_id()]
message = "" message = ""
if self.base_url.value != "": if self.base_url.value != "":
await Pterodactyl.config.guild(self.guild).base_url.set(self.base_url) config_list[0].set(self.base_url)
message += f"Base URL set to `{self.base_url.value}`.\n" message += f"Base URL set to `{self.base_url.value}`.\n"
if self.api_key.value != "": if self.api_key.value != "":
await Pterodactyl.config.guild(self.guild).api_key.set(self.api_key) config_list[1].set(self.api_key)
message += f"API Key set to `{self.api_key.value}`.\n" message += f"API Key set to `{self.api_key.value}`.\n"
if self.server_id.value != "": if self.server_id.value != "":
await Pterodactyl.config.guild(self.guild).server_id.set(self.server_id) config_list[2].set(self.server_id)
message += f"Server ID set to `{self.server_id.value}`.\n" message += f"Server ID set to `{self.server_id.value}`.\n"
if message == "": if message == "":
config_list = [await Pterodactyl.config.guild(self.guild).base_url(), await Pterodactyl.config.guild(self.guild).api_key(), await Pterodactyl.config.guild(self.guild).server_id()]
message = f"No changes were made.\nCurrent configuration:\n- Base URL: `{config_list[0]}`\n- API Key: `{config_list[1]}`\n- Server ID: `{config_list[2]}`" message = f"No changes were made.\nCurrent configuration:\n- Base URL: `{config_list[0]}`\n- API Key: `{config_list[1]}`\n- Server ID: `{config_list[2]}`"
await interaction.response.send_message(message, ephemeral=True) await interaction.response.send_message(message, ephemeral=True)