From 1aa4eddb3b14b2e72c3b698012634508c3d9bf9d Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Thu, 2 Oct 2025 19:07:37 -0700 Subject: [PATCH] Update filemon.py --- modules/filemon.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/filemon.py b/modules/filemon.py index 91bb249..16a549f 100644 --- a/modules/filemon.py +++ b/modules/filemon.py @@ -95,10 +95,13 @@ def handleShellCmd(message, message_from_id, channel_number, isDM, deviceID): return "x: command not authorized in group chat" if enable_runShellCmd: - if message.startswith("x: "): - command = message.removeprefix("x: ").strip() - elif message.startswith("x:"): - command = message.removeprefix("x:").strip() + if message.lower().startswith("x:"): + # Remove 'x:' (case-insensitive) + command = message[2:] + # If there's a space after 'x:', remove it + if command.startswith(" "): + command = command[1:] + command = command.strip() else: return "x: invalid command format" @@ -113,4 +116,5 @@ def handleShellCmd(message, message_from_id, channel_number, isDM, deviceID): logger.warning(f"FileMon: Error running shell command: {e}") return "x: command error" else: - return "x: command is disabled" \ No newline at end of file + logger.debug("FileMon: x: command is disabled by no enable_runShellCmd") + return "x: command is disabled"