awaited get_url
This commit is contained in:
parent
a9fe5f09b6
commit
26872a6efc
1 changed files with 6 additions and 6 deletions
|
@ -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))
|
||||
|
|
Reference in a new issue