Update filemon.py

This commit is contained in:
SpudGunMan
2025-10-02 19:07:37 -07:00
parent a7de64b385
commit 1aa4eddb3b
+9 -5
View File
@@ -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"
logger.debug("FileMon: x: command is disabled by no enable_runShellCmd")
return "x: command is disabled"