From dcd3560fbca792d9a81144ff15da383f9e67d320 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 24 Jul 2023 09:04:58 -0400 Subject: [PATCH] fix: fixed power and update commands' error checking --- pterodactyl/ptero.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pterodactyl/ptero.py b/pterodactyl/ptero.py index be7419f..428e497 100644 --- a/pterodactyl/ptero.py +++ b/pterodactyl/ptero.py @@ -57,7 +57,7 @@ class Pterodactyl(commands.Cog): @app_commands.guild_only() async def update(self, interaction: discord.Interaction): """Updates the server using the arguments provided in the server's configuration.""" - if await self.config.guild(self.passed_info['guild']).power_action_in_progress() is True: + if await self.config.guild(interaction.guild).power_action_in_progress() is True: await interaction.response.send_message(ephemeral=True, content="Power action already in progress!\nTry again later.") return session = self.session @@ -102,7 +102,7 @@ class Pterodactyl(commands.Cog): } ] if response_dict['attributes']['current_state'] == "offline": - await self.config.guild(self.passed_info['guild']).power_action_in_progress().set(True) + await self.config.guild(interaction.guild).power_action_in_progress().set(True) for data in updater_startup_vars: await session.put(await self.get_url(interaction.guild, "startup/variable"), headers=headers, json=data) await session.post(await self.get_url(interaction.guild, "power"), headers=headers, json={"signal": "start"}) @@ -120,7 +120,7 @@ class Pterodactyl(commands.Cog): for data in old_startup_vars: await session.put(await self.get_url(interaction.guild, "startup/variable"), headers=headers, json=data) await interaction_message.edit(content="Updater finished.\nUpdate process completed!") - await self.config.guild(self.passed_info['guild']).power_action_in_progress().set(False) + await self.config.guild(interaction.guild).power_action_in_progress().set(False) elif response_dict['attributes']['current_state'] == "running" or response_dict['attributes']['current_state'] == "starting": passed_info = { "headers": headers, @@ -137,7 +137,7 @@ class Pterodactyl(commands.Cog): @app_commands.guild_only() async def start(self, interaction: discord.Interaction): """Starts the server.""" - if await self.config.guild(self.passed_info['guild']).power_action_in_progress() is True: + if await self.config.guild(interaction.guild).power_action_in_progress() is True: await interaction.response.send_message(ephemeral=True, content="Power action already in progress!\nTry again later.") return await interaction.response.defer(ephemeral=True, thinking=True) @@ -165,7 +165,7 @@ class Pterodactyl(commands.Cog): @app_commands.guild_only() async def restart(self, interaction: discord.Interaction): """Restarts the server.""" - if await self.config.guild(self.passed_info['guild']).power_action_in_progress() is True: + if await self.config.guild(interaction.guild).power_action_in_progress() is True: await interaction.response.send_message(ephemeral=True, content="Power action already in progress!\nTry again later.") return await interaction.response.defer(ephemeral=True, thinking=True) @@ -196,7 +196,7 @@ class Pterodactyl(commands.Cog): @app_commands.guild_only() async def stop(self, interaction: discord.Interaction): """Stops the server.""" - if await self.config.guild(self.passed_info['guild']).power_action_in_progress() is True: + if await self.config.guild(interaction.guild).power_action_in_progress() is True: await interaction.response.send_message(ephemeral=True, content="Power action already in progress!\nTry again later.") return await interaction.response.defer(ephemeral=True, thinking=True)