fix: fixed power_action_in_progress
This commit is contained in:
parent
3ed6cffe5d
commit
db764b54e2
1 changed files with 6 additions and 6 deletions
|
@ -102,7 +102,7 @@ class Pterodactyl(commands.Cog):
|
|||
}
|
||||
]
|
||||
if response_dict['attributes']['current_state'] == "offline":
|
||||
await self.config.guild(interaction.guild).power_action_in_progress().set(True)
|
||||
await self.config.guild(interaction.guild).power_action_in_progress.set(True)
|
||||
for data in updater_startup_vars:
|
||||
await session.put(await self.get_url(interaction.guild, "startup/variable"), headers=headers, json=data)
|
||||
await session.post(await self.get_url(interaction.guild, "power"), headers=headers, json={"signal": "start"})
|
||||
|
@ -120,7 +120,7 @@ class Pterodactyl(commands.Cog):
|
|||
for data in old_startup_vars:
|
||||
await session.put(await self.get_url(interaction.guild, "startup/variable"), headers=headers, json=data)
|
||||
await interaction_message.edit(content="Updater finished.\nUpdate process completed!")
|
||||
await self.config.guild(interaction.guild).power_action_in_progress().set(False)
|
||||
await self.config.guild(interaction.guild).power_action_in_progress.set(False)
|
||||
elif response_dict['attributes']['current_state'] == "running" or response_dict['attributes']['current_state'] == "starting":
|
||||
passed_info = {
|
||||
"headers": headers,
|
||||
|
@ -229,7 +229,7 @@ class Pterodactyl(commands.Cog):
|
|||
|
||||
@ui.button(label="Yes", style=discord.ButtonStyle.success)
|
||||
async def yes_button(self, button:ui.Button, interaction:discord.Interaction):
|
||||
await self.config.guild(self.passed_info['guild']).power_action_in_progress().set(True)
|
||||
await self.config.guild(self.passed_info['guild']).power_action_in_progress.set(True)
|
||||
session = self.session
|
||||
await session.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(content="Server stopping...", view=None)
|
||||
|
@ -270,7 +270,7 @@ class Pterodactyl(commands.Cog):
|
|||
else:
|
||||
await asyncio.sleep(0.5)
|
||||
continue
|
||||
await self.config.guild(self.passed_info['guild']).power_action_in_progress().set(False)
|
||||
await self.config.guild(self.passed_info['guild']).power_action_in_progress.set(False)
|
||||
|
||||
@ui.button(label="No", style=discord.ButtonStyle.danger)
|
||||
async def no_button(self, button:ui.Button, interaction:discord.Interaction):
|
||||
|
@ -286,7 +286,7 @@ class Pterodactyl(commands.Cog):
|
|||
|
||||
@ui.button(label="Yes", style=discord.ButtonStyle.success)
|
||||
async def yes_button(self, button:ui.Button, interaction:discord.Interaction):
|
||||
await self.config.guild(self.passed_info['guild']).power_action_in_progress().set(True)
|
||||
await self.config.guild(self.passed_info['guild']).power_action_in_progress.set(True)
|
||||
headers = self.passed_info['headers']
|
||||
await self.session.post(await Pterodactyl.get_url(self, self.passed_info['guild'], "power"), headers=headers, json={"signal": self.passed_info['signal']})
|
||||
message = await self.passed_info['interaction'].edit_original_response(content=self.passed_info['message'], view=None)
|
||||
|
@ -299,7 +299,7 @@ class Pterodactyl(commands.Cog):
|
|||
else:
|
||||
await asyncio.sleep(1)
|
||||
continue
|
||||
await self.config.guild(self.passed_info['guild']).power_action_in_progress().set(False)
|
||||
await self.config.guild(self.passed_info['guild']).power_action_in_progress.set(False)
|
||||
|
||||
@ui.button(label="No", style=discord.ButtonStyle.danger)
|
||||
async def no_button(self, button:ui.Button, interaction:discord.Interaction):
|
||||
|
|
Reference in a new issue