changed some text

This commit is contained in:
Seaswimmer 2023-07-15 18:23:25 -04:00
parent 40d3bb6115
commit defc367cb1
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -95,13 +95,14 @@ class Pterodactyl(commands.Cog):
async with session.get(await self.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() response_dict = await response.json()
if response_dict['attributes']['current_state'] == "offline": if response_dict['attributes']['current_state'] == "offline":
await interaction_message.edit(content="Packwiz installer finished!") await interaction_message.edit(content="Packwiz installer finished.")
break break
else: else:
await asyncio.sleep(1) await asyncio.sleep(1)
continue continue
for data in new_put_data: for data in new_put_data:
await self.put(await self.get_url(interaction.guild, "startup/variable"), headers, data) await self.put(await self.get_url(interaction.guild, "startup/variable"), headers, data)
interaction_message.edit(content="Packwiz installer finished.\nUpdate process completed!")
elif response_dict['attributes']['current_state'] == "running" or response_dict['attributes']['current_state'] == "starting": elif response_dict['attributes']['current_state'] == "running" or response_dict['attributes']['current_state'] == "starting":
passed_info = [old_startup_args[0], old_startup_args[1], headers, put_data, new_put_data, interaction_message] passed_info = [old_startup_args[0], old_startup_args[1], headers, put_data, new_put_data, interaction_message]
await interaction_message.edit(content="Server is already running! Are you sure you'd like to stop the server for updates?", view=self.UpdateButtons(timeout=180, passed_info=passed_info)) await interaction_message.edit(content="Server is already running! Are you sure you'd like to stop the server for updates?", view=self.UpdateButtons(timeout=180, passed_info=passed_info))
@ -113,7 +114,17 @@ class Pterodactyl(commands.Cog):
@discord.ui.button(label="Yes", style=discord.ButtonStyle.green, emoji="") @discord.ui.button(label="Yes", style=discord.ButtonStyle.green, emoji="")
async def yes_button(self, button:discord.ui.Button, interaction:discord.Interaction): async def yes_button(self, button:discord.ui.Button, interaction:discord.Interaction):
await self.passed_info[5].edit("Server stopping!") await self.passed_info[5].edit("Server stopping...")
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:
response_dict = await response.json()
if response_dict['attributes']['current_state'] == "offline":
await self.passed_info[5].edit("Server stopped!")
break
else:
await asyncio.sleep(1)
continue
requests.post(await Pterodactyl.get_url(interaction.guild, "power"), headers=self.passed_info[2], json={"signal": "stop"}) requests.post(await Pterodactyl.get_url(interaction.guild, "power"), headers=self.passed_info[2], json={"signal": "stop"})
for data in self.passed_info[3]: for data in self.passed_info[3]:
await Pterodactyl.put(await Pterodactyl.get_url(interaction.guild, "startup/variable"), self.passed_info[2], data) await Pterodactyl.put(await Pterodactyl.get_url(interaction.guild, "startup/variable"), self.passed_info[2], data)
@ -139,7 +150,7 @@ class Pterodactyl(commands.Cog):
async with session.get(await Pterodactyl.get_url(interaction.guild, "resources"), headers=self.passed_info[2]) as response: async with session.get(await Pterodactyl.get_url(interaction.guild, "resources"), headers=self.passed_info[2]) 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[5].edit("Server started!\nUpdate process completed!!") await self.passed_info[5].edit("Server started!\nUpdate process completed!")
break break
else: else:
await asyncio.sleep(1) await asyncio.sleep(1)