fix: changed how interactions edit messages

This commit is contained in:
Seaswimmer 2023-07-15 23:01:28 -04:00
parent c24cffcc31
commit 73f6520fac
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -121,7 +121,7 @@ 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(interaction.guild, "power"), headers=self.passed_info['headers'], json={"signal": "stop"}) requests.post(await Pterodactyl.get_url(interaction.guild, "power"), headers=self.passed_info['headers'], json={"signal": "stop"})
await interaction.response.edit_message("Server stopping...", view=None) await interaction.edit_original_response("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(interaction.guild, "resources"), headers=self.passed_info['headers']) as response: async with session.get(await Pterodactyl.get_url(interaction.guild, "resources"), headers=self.passed_info['headers']) as response:
@ -167,7 +167,7 @@ class Pterodactyl(commands.Cog):
async def no_button(self, button:ui.Button, interaction:discord.Interaction): async def no_button(self, button:ui.Button, interaction:discord.Interaction):
for button in self.children: for button in self.children:
button.disabled = True button.disabled = True
await interaction.response.edit_message(content=f"Command cancelled.", view=self) await interaction.edit_original_response(content=f"Command cancelled.", view=self)
@app_commands.command() @app_commands.command()
async def test(self, interaction: discord.Interaction, endpoint: str = None): async def test(self, interaction: discord.Interaction, endpoint: str = None):