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"