fix(pterodactyl): fixed some bugs

This commit is contained in:
Seaswimmer 2024-03-05 02:18:11 -05:00
parent b2f27f9490
commit df92bc34cc
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -126,11 +126,11 @@ class Pterodactyl(commands.Cog):
message = await ctx.send("Are you sure you want to start the server?", view=view) message = await ctx.send("Are you sure you want to start the server?", view=view)
await view.wait() await view.wait()
if view.result is True: if view.result is True:
await ctx.message("Sending websocket command to start server...") await message.edit(content="Sending websocket command to start server...", view=None)
await self.websocket.send(json.dumps({"event": "set state", "args": ["start"]})) await self.websocket.send(json.dumps({"event": "set state", "args": ["start"]}))
await message.edit(content="Server starting...") await message.edit(content="Server starting...")
else: else:
await message.edit(content="Cancelled.") await message.edit(content="Cancelled.", view=None)
@pterodactyl_power.command(name = "stop") @pterodactyl_power.command(name = "stop")
async def pterodactyl_power_stop(self, ctx: commands.Context) -> None: async def pterodactyl_power_stop(self, ctx: commands.Context) -> None:
@ -144,11 +144,11 @@ class Pterodactyl(commands.Cog):
message = await ctx.send("Are you sure you want to stop the server?", view=view) message = await ctx.send("Are you sure you want to stop the server?", view=view)
await view.wait() await view.wait()
if view.result is True: if view.result is True:
await message.edit("Sending websocket command to stop server...") await message.edit(content="Sending websocket command to stop server...", view=None)
await self.websocket.send(json.dumps({"event": "set state", "args": ["stop"]})) await self.websocket.send(json.dumps({"event": "set state", "args": ["stop"]}))
await message.edit(content="Server stopping...") await message.edit(content="Server stopping...")
else: else:
await message.edit(content="Cancelled.") await message.edit(content="Cancelled.", view=None)
@pterodactyl_power.command(name = "restart") @pterodactyl_power.command(name = "restart")
async def pterodactyl_power_restart(self, ctx: commands.Context) -> None: async def pterodactyl_power_restart(self, ctx: commands.Context) -> None:
@ -160,11 +160,11 @@ class Pterodactyl(commands.Cog):
message = await ctx.send("Are you sure you want to restart the server?", view=view) message = await ctx.send("Are you sure you want to restart the server?", view=view)
await view.wait() await view.wait()
if view.result is True: if view.result is True:
await message.edit("Sending websocket command to restart server...") await message.edit(content="Sending websocket command to restart server...", view=None)
await self.websocket.send(json.dumps({"event": "set state", "args": ["restart"]})) await self.websocket.send(json.dumps({"event": "set state", "args": ["restart"]}))
await message.edit(content="Server restarting...") await message.edit(content="Server restarting...")
else: else:
await message.edit(content="Cancelled.") await message.edit(content="Cancelled.", view=None)
@pterodactyl.group(autohelp = True, name = "config", aliases = ["settings", "set"]) @pterodactyl.group(autohelp = True, name = "config", aliases = ["settings", "set"])
@commands.is_owner() @commands.is_owner()