fix: awaited some things inside power commands

This commit is contained in:
Seaswimmer 2023-07-24 09:06:56 -04:00
parent dcd3560fbc
commit 3ed6cffe5d
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -144,7 +144,7 @@ class Pterodactyl(commands.Cog):
interaction_message = await interaction.original_response() interaction_message = await interaction.original_response()
headers = await self.get_headers(interaction.guild) headers = await self.get_headers(interaction.guild)
async with self.session.get(await self.get_url(interaction.guild, "resources"), headers=headers) as response: async with self.session.get(await self.get_url(interaction.guild, "resources"), headers=headers) as response:
response_json = response.json() response_json = await response.json()
current_status = response_json['attributes']['current_state'] current_status = response_json['attributes']['current_state']
if current_status == "offline": if current_status == "offline":
passed_info = { passed_info = {
@ -172,7 +172,7 @@ class Pterodactyl(commands.Cog):
interaction_message = await interaction.original_response() interaction_message = await interaction.original_response()
headers = await self.get_headers(interaction.guild) headers = await self.get_headers(interaction.guild)
async with self.session.get(await self.get_url(interaction.guild, "resources"), headers=headers) as response: async with self.session.get(await self.get_url(interaction.guild, "resources"), headers=headers) as response:
response_json = response.json() response_json = await response.json()
current_status = response_json['attributes']['current_state'] current_status = response_json['attributes']['current_state']
if current_status == "running": if current_status == "running":
passed_info = { passed_info = {
@ -203,7 +203,7 @@ class Pterodactyl(commands.Cog):
interaction_message = await interaction.original_response() interaction_message = await interaction.original_response()
headers = await self.get_headers(interaction.guild) headers = await self.get_headers(interaction.guild)
async with requests.get(await self.get_url(interaction.guild, "resources"), headers=headers) as response: async with requests.get(await self.get_url(interaction.guild, "resources"), headers=headers) as response:
response_json = response.json() response_json = await response.json()
current_status = response_json['attributes']['current_state'] current_status = response_json['attributes']['current_state']
if current_status == "running" or current_status == "starting": if current_status == "running" or current_status == "starting":
passed_info = { passed_info = {