From defc367cb181d30d56d62543ca18406a39940249 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Sat, 15 Jul 2023 18:23:25 -0400 Subject: [PATCH] changed some text --- pterodactyl/ptero.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pterodactyl/ptero.py b/pterodactyl/ptero.py index 76bba2a..a29f89a 100644 --- a/pterodactyl/ptero.py +++ b/pterodactyl/ptero.py @@ -95,13 +95,14 @@ class Pterodactyl(commands.Cog): async with session.get(await self.get_url(interaction.guild, "resources"), headers=headers) as response: response_dict = await response.json() if response_dict['attributes']['current_state'] == "offline": - await interaction_message.edit(content="Packwiz installer finished!") + await interaction_message.edit(content="Packwiz installer finished.") break else: await asyncio.sleep(1) continue for data in new_put_data: await self.put(await self.get_url(interaction.guild, "startup/variable"), headers, data) + interaction_message.edit(content="Packwiz installer finished.\nUpdate process completed!") elif response_dict['attributes']['current_state'] == "running" or response_dict['attributes']['current_state'] == "starting": passed_info = [old_startup_args[0], old_startup_args[1], headers, put_data, new_put_data, interaction_message] await interaction_message.edit(content="Server is already running! Are you sure you'd like to stop the server for updates?", view=self.UpdateButtons(timeout=180, passed_info=passed_info)) @@ -113,7 +114,17 @@ class Pterodactyl(commands.Cog): @discord.ui.button(label="Yes", style=discord.ButtonStyle.green, emoji="✅") async def yes_button(self, button:discord.ui.Button, interaction:discord.Interaction): - await self.passed_info[5].edit("Server stopping!") + await self.passed_info[5].edit("Server stopping...") + while True: + async with aiohttp.ClientSession() as session: + async with session.get(await Pterodactyl.get_url(interaction.guild, "resources"), headers=self.passed_info[2]) as response: + response_dict = await response.json() + if response_dict['attributes']['current_state'] == "offline": + await self.passed_info[5].edit("Server stopped!") + break + else: + await asyncio.sleep(1) + continue requests.post(await Pterodactyl.get_url(interaction.guild, "power"), headers=self.passed_info[2], json={"signal": "stop"}) for data in self.passed_info[3]: await Pterodactyl.put(await Pterodactyl.get_url(interaction.guild, "startup/variable"), self.passed_info[2], data) @@ -139,7 +150,7 @@ class Pterodactyl(commands.Cog): async with session.get(await Pterodactyl.get_url(interaction.guild, "resources"), headers=self.passed_info[2]) as response: response_dict = await response.json() if response_dict['attributes']['current_state'] == "running": - await self.passed_info[5].edit("Server started!\nUpdate process completed!!") + await self.passed_info[5].edit("Server started!\nUpdate process completed!") break else: await asyncio.sleep(1)