Compare commits

..

No commits in common. "8c58e1746e701ad0f7419fd15b26199f84f1e8b2" and "80cb729e72cb0221e33e54144bfe27a74c957e1e" have entirely different histories.

View file

@ -115,7 +115,7 @@ class Pterodactyl(commands.Cog):
"""Send power actions to the server.""" """Send power actions to the server."""
@pterodactyl_power.command(name = "start") @pterodactyl_power.command(name = "start")
async def pterodactyl_power_start(self, ctx: commands.Context) -> Optional[discord.Message]: async def pterodactyl_power_start(self, ctx: commands.Context) -> None:
"""Start the server.""" """Start the server."""
current_status = await config.current_status() current_status = await config.current_status()
if current_status == "running": if current_status == "running":
@ -133,7 +133,7 @@ class Pterodactyl(commands.Cog):
await message.edit(content="Cancelled.", view=None) 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) -> Optional[discord.Message]: async def pterodactyl_power_stop(self, ctx: commands.Context) -> None:
"""Stop the server.""" """Stop the server."""
current_status = await config.current_status() current_status = await config.current_status()
if current_status == "stopped": if current_status == "stopped":
@ -151,7 +151,7 @@ class Pterodactyl(commands.Cog):
await message.edit(content="Cancelled.", view=None) 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) -> Optional[discord.Message]: async def pterodactyl_power_restart(self, ctx: commands.Context) -> None:
"""Restart the server.""" """Restart the server."""
current_status = await config.current_status() current_status = await config.current_status()
if current_status in ["starting", "stopping"]: if current_status in ["starting", "stopping"]:
@ -166,22 +166,6 @@ class Pterodactyl(commands.Cog):
else: else:
await message.edit(content="Cancelled.", view=None) await message.edit(content="Cancelled.", view=None)
@pterodactyl_power.command(name = "kill")
async def pterodactyl_power_kill(self, ctx: commands.Context) -> Optional[discord.Message]:
"""Kill the server."""
current_status = await config.current_status()
if current_status == 'stopped':
return await ctx.send("Server is already stopped.")
view = ConfirmView(ctx.author, disable_buttons=True)
message = await ctx.send("**⚠️ Forcefully killing the server process can corrupt data in some cases.**\nAre you sure you want to kill the server?", view=view)
await view.wait()
if view.result is True:
await message.edit(content="Sending websocket command to kill server...", view=None)
await self.websocket.send(json.dumps({"event": "set state", "args": ["kill"]}))
await message.edit(content="Server stopping... (forcefully killed)", view=None)
else:
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()
async def pterodactyl_config(self, ctx: commands.Context) -> None: async def pterodactyl_config(self, ctx: commands.Context) -> None: