From 26872a6efc62a05a5ef79c8b38d3c1d059af4fd1 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Sat, 15 Jul 2023 15:36:57 -0400 Subject: [PATCH] awaited get_url --- pterodactyl/ptero.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pterodactyl/ptero.py b/pterodactyl/ptero.py index b8fd0b3..b4d71a2 100644 --- a/pterodactyl/ptero.py +++ b/pterodactyl/ptero.py @@ -54,9 +54,9 @@ class Pterodactyl(commands.Cog): "Content-Type": "application/json", "Accept": "Application/vnd.pterodactyl.v1+json" } - response = requests.get(Pterodactyl.get_url(interaction.guild, "resources"), headers=headers) + response = requests.get(await self.get_url(interaction.guild, "resources"), headers=headers) response_dict = response.json() - list_var = requests.get(Pterodactyl.get_url(interaction.guild, "startup"), headers=headers) + list_var = requests.get(await self.get_url(interaction.guild, "startup"), headers=headers) list_var_response_dict = list_var.json() old_startup_args = [list_var_response_dict['data'][0]['attributes']['server_value'], list_var_response_dict['meta']['startup_command']] put_data = [ @@ -71,7 +71,7 @@ class Pterodactyl(commands.Cog): ] if response_dict['attributes']['current_state'] == "offline": for data in put_data: - await self.put(Pterodactyl.get_url(interaction.guild, "startup/variable"), headers, data) + await self.put(await self.get_url(interaction.guild, "startup/variable"), headers, data) new_put_data = [ { "key": "FLAGS", @@ -82,11 +82,11 @@ class Pterodactyl(commands.Cog): "value": old_startup_args[0] } ] - requests.post(Pterodactyl.get_url(interaction.guild, "power"), headers=headers, json={"signal": "start"}) + requests.post(await self.get_url(interaction.guild, "power"), headers=headers, json={"signal": "start"}) await interaction.response.send_message("Packwiz installer started...", ephemeral=True) while True: async with aiohttp.ClientSession() as session: - async with session.get(Pterodactyl.get_url(interaction.guild, "resources"), headers=headers) as response: + 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.original_response.edit("Packwiz installer finished!") @@ -95,7 +95,7 @@ class Pterodactyl(commands.Cog): await asyncio.sleep(1) continue for data in new_put_data: - await self.put(Pterodactyl.get_url(interaction.guild, "startup/variable"), headers, data) + await self.put(await self.get_url(interaction.guild, "startup/variable"), headers, data) elif response_dict['attributes']['current_state'] == "running": passed_info = [old_startup_args[0], old_startup_args[1], headers, put_data, new_put_data] await interaction.response.send_message("Server is already running! Are you sure you'd like to stop the server for updates?", ephemeral=True, view=self.UpdateButtons(timeout=180, passed_info=passed_info))