fix: updated get_url's in updatebuttons to fetch guilds properly

This commit is contained in:
Seaswimmer 2023-07-16 08:21:45 -04:00
parent 6c73df59da
commit 763b09547c
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -127,7 +127,7 @@ class Pterodactyl(commands.Cog):
await self.passed_info['interaction'].edit_original_response(content="Server stopping...", view=None) await self.passed_info['interaction'].edit_original_response(content="Server stopping...", view=None)
while True: while True:
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(await Pterodactyl.get_url(self, interaction.guild, "resources"), headers=self.passed_info['headers']) as response: async with session.get(await Pterodactyl.get_url(self, self.passed_info['guild'], "resources"), headers=self.passed_info['headers']) as response:
response_dict = await response.json() response_dict = await response.json()
if response_dict['attributes']['current_state'] == "offline": if response_dict['attributes']['current_state'] == "offline":
await self.passed_info['interaction'].edit_original_response(content="\nServer stopped!") await self.passed_info['interaction'].edit_original_response(content="\nServer stopped!")
@ -136,13 +136,13 @@ class Pterodactyl(commands.Cog):
await asyncio.sleep(2) await asyncio.sleep(2)
continue continue
for data in self.passed_info['updater_startup_vars']: for data in self.passed_info['updater_startup_vars']:
await Pterodactyl.put(await Pterodactyl.get_url(self, interaction.guild, "startup/variable"), self.passed_info['headers'], data) await Pterodactyl.put(await Pterodactyl.get_url(self, self.passed_info['guild'], "startup/variable"), self.passed_info['headers'], data)
requests.post(await Pterodactyl.get_url(self, interaction.guild, "power"), headers=self.passed_info['headers'], json={"signal": "start"}) requests.post(await Pterodactyl.get_url(self, self.passed_info['guild'], "power"), headers=self.passed_info['headers'], json={"signal": "start"})
await self.passed_info['interaction'].edit_original_response(content="Packwiz installer started...") await self.passed_info['interaction'].edit_original_response(content="Packwiz installer started...")
await asyncio.sleep(1) await asyncio.sleep(1)
while True: while True:
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(await Pterodactyl.get_url(self, interaction.guild, "resources"), headers=self.passed_info['headers']) as response: async with session.get(await Pterodactyl.get_url(self, self.passed_info['guild'], "resources"), headers=self.passed_info['headers']) as response:
response_dict = await response.json() response_dict = await response.json()
if response_dict['attributes']['current_state'] == "offline": if response_dict['attributes']['current_state'] == "offline":
await self.passed_info['interaction'].edit_original_response(content="Packwiz installer finished!") await self.passed_info['interaction'].edit_original_response(content="Packwiz installer finished!")
@ -151,13 +151,13 @@ class Pterodactyl(commands.Cog):
await asyncio.sleep(1) await asyncio.sleep(1)
continue continue
for data in self.passed_info['old_startup_vars']: for data in self.passed_info['old_startup_vars']:
await Pterodactyl.put(Pterodactyl.get_url(self, interaction.guild, "startup/variable"), self.passed_info['headers'], data) await Pterodactyl.put(Pterodactyl.get_url(self, self.passed_info['guild'], "startup/variable"), self.passed_info['headers'], data)
asyncio.sleep(1) asyncio.sleep(1)
requests.post(await Pterodactyl.get_url(self, interaction.guild, "power"), self.passed_info['headers'], json={"signal": "start"}) requests.post(await Pterodactyl.get_url(self, self.passed_info['guild'], "power"), self.passed_info['headers'], json={"signal": "start"})
await self.passed_info['interaction'].edit_original_response(content="Server starting...") await self.passed_info['interaction'].edit_original_response(content="Server starting...")
while True: while True:
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(await Pterodactyl.get_url(self, interaction.guild, "resources"), headers=self.passed_info['headers']) as response: async with session.get(await Pterodactyl.get_url(self, self.passed_info['guild'], "resources"), headers=self.passed_info['headers']) as response:
response_dict = await response.json() response_dict = await response.json()
if response_dict['attributes']['current_state'] == "running": if response_dict['attributes']['current_state'] == "running":
await self.passed_info['interaction'].edit_original_response(content="Server started!\nUpdate process completed!") await self.passed_info['interaction'].edit_original_response(content="Server started!\nUpdate process completed!")