From 9c8f143de4132ce3344031b62585a38d567db77d Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 14 Jul 2023 12:27:03 -0400 Subject: [PATCH] I think I actually fixed it this time --- pterodactyl/ptero.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pterodactyl/ptero.py b/pterodactyl/ptero.py index a33a6dd..7637d68 100644 --- a/pterodactyl/ptero.py +++ b/pterodactyl/ptero.py @@ -42,11 +42,10 @@ class Pterodactyl(commands.Cog): @app_commands.command() async def config(self, interaction: discord.Interaction): """Configures the Pterodactyl cog.""" - config_list = [await self.config.guild(interaction.guild).base_url(), await self.config.guild(interaction.guild).api_key(), await self.config.guild(interaction.guild).server_id()] - await interaction.response.send_modal(self.ConfigModal(config_list)) + await interaction.response.send_modal(self.ConfigModal(self.config)) class ConfigModal(discord.ui.Modal, title="Pterodactyl Manager Configuration"): - def __init__(self, config: list): + def __init__(self, config): super().__init__() self.config = config base_url = discord.ui.TextInput( @@ -74,14 +73,14 @@ class Pterodactyl(commands.Cog): async def on_submit(self, interaction: discord.Interaction): message = "" if self.base_url.value != "": - self.config[0].set(self.base_url) + self.config.guild(interaction.guild).base_url.set(self.base_url) message += f"Base URL set to `{self.base_url.value}`.\n" if self.api_key.value != "": - self.config[1].set(self.api_key) + self.config.guild(interaction.guild).api_key.set(self.api_key) message += f"API Key set to `{self.api_key.value}`.\n" if self.server_id.value != "": - self.config[2].set(self.server_id) + self.config.guild(interaction.guild).server_id.set(self.server_id) message += f"Server ID set to `{self.server_id.value}`.\n" if message == "": - message = f"No changes were made.\nCurrent configuration:\n- Base URL: `{self.config[0]}`\n- API Key: `{self.config[1]}`\n- Server ID: `{self.config[2]}`" + message = f"No changes were made.\nCurrent configuration:\n- Base URL: `{self.config.guild(interaction.guild).base_url()}`\n- API Key: `{self.config.guild(interaction.guild).api_key()}`\n- Server ID: `{self.config.guild(interaction.guild).server_id()}`" await interaction.response.send_message(message, ephemeral=True)