fix: hopefully fixed message editing

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

View file

@ -124,13 +124,13 @@ class Pterodactyl(commands.Cog):
@ui.button(label="Yes", style=discord.ButtonStyle.success) @ui.button(label="Yes", style=discord.ButtonStyle.success)
async def yes_button(self, button:ui.Button, interaction:discord.Interaction): async def yes_button(self, button:ui.Button, interaction:discord.Interaction):
requests.post(await Pterodactyl.get_url(self, self.passed_info['guild'], "power"), headers=self.passed_info['headers'], json={"signal": "stop"}) requests.post(await Pterodactyl.get_url(self, self.passed_info['guild'], "power"), headers=self.passed_info['headers'], json={"signal": "stop"})
await self.passed_info['interaction'].edit_original_response("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, interaction.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("\nServer stopped!") await self.passed_info['interaction'].edit_original_response(content="\nServer stopped!")
break break
else: else:
await asyncio.sleep(2) await asyncio.sleep(2)
@ -138,14 +138,14 @@ class Pterodactyl(commands.Cog):
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, interaction.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, interaction.guild, "power"), headers=self.passed_info['headers'], json={"signal": "start"})
await self.passed_info['interaction'].edit_original_response("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, interaction.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("Packwiz installer finished!") await self.passed_info['interaction'].edit_original_response(content="Packwiz installer finished!")
break break
else: else:
await asyncio.sleep(1) await asyncio.sleep(1)
@ -154,13 +154,13 @@ class Pterodactyl(commands.Cog):
await Pterodactyl.put(Pterodactyl.get_url(self, interaction.guild, "startup/variable"), self.passed_info['headers'], data) await Pterodactyl.put(Pterodactyl.get_url(self, interaction.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, interaction.guild, "power"), self.passed_info['headers'], json={"signal": "start"})
await self.passed_info['interaction'].edit_original_response("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, interaction.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("Server started!\nUpdate process completed!") await self.passed_info['interaction'].edit_original_response(content="Server started!\nUpdate process completed!")
break break
else: else:
await asyncio.sleep(1) await asyncio.sleep(1)