From dee20374f294b88065a17672bcf4d37587fb1cca Mon Sep 17 00:00:00 2001 From: Nayan <33187059+GShadow5@users.noreply.github.com> Date: Mon, 25 Aug 2025 22:33:10 -0400 Subject: [PATCH] fix forcestop and prevent botstop if server running --- bot.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/bot.py b/bot.py index f564fbe..777f243 100644 --- a/bot.py +++ b/bot.py @@ -211,7 +211,7 @@ async def _stop_server_internal(ctx, servername, method): if method == "stop": command_to_send = 'stop\n' elif method == "forcestop": - command_to_send = "$'\\003'" # Ctrl+C + command_to_send = "$'\003'" # Ctrl+C else: await ctx.send("Invalid stop method.") return @@ -496,18 +496,11 @@ async def botstop(ctx): ''' global active_server, active_server_pipe_task - if active_server_pipe_task: - active_server_pipe_task.cancel() - try: - await active_server_pipe_task # Await to ensure it cleans up - except asyncio.CancelledError: - pass # Expected - active_server_pipe_task = None - - if active_server: - await _delete_named_pipe(active_server) # Delete the pipe file - + if active_server is not None: + await ctx.send(f"Server running, please stop the server before stopping the bot.") + return await bot.close() + print("Bot stopped.") bot.run(TOKEN)