fixed the server never stopping in update

This commit is contained in:
Seaswimmer 2023-07-15 18:53:38 -04:00
parent e190b613ba
commit 65e0a954ad
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -115,7 +115,8 @@ class Pterodactyl(commands.Cog):
@discord.ui.button(label="Yes", style=discord.ButtonStyle.success)
async def yes_button(self, button:discord.ui.Button, interaction:discord.Interaction):
await self.passed_info[5].edit("Server stopping...")
requests.post(await self.get_url(interaction.guild, "power"), headers=headers, json={"signal": "stop"})
await self.passed_info[5].edit("Server stopping...", view=None)
while True:
async with aiohttp.ClientSession() as session:
async with session.get(await Pterodactyl.get_url(interaction.guild, "resources"), headers=self.passed_info[2]) as response:
@ -124,9 +125,8 @@ class Pterodactyl(commands.Cog):
await self.passed_info[5].edit("Server stopped!")
break
else:
await asyncio.sleep(1)
await asyncio.sleep(2)
continue
requests.post(await Pterodactyl.get_url(interaction.guild, "power"), headers=self.passed_info[2], json={"signal": "stop"})
for data in self.passed_info[3]:
await Pterodactyl.put(await Pterodactyl.get_url(interaction.guild, "startup/variable"), self.passed_info[2], data)
requests.post(await Pterodactyl.get_url(interaction.guild, "power"), headers=self.passed_info[2], json={"signal": "start"})