fix(bot): handle whitespace in command input

Updated the command parser to correctly process non-empty inputs by checking if the event body contains a command, even with leading or trailing spaces. This prevents misinterpretations of valid commands with extra spaces and ensures the bot responds appropriately.
This commit is contained in:
Kumi 2024-08-17 18:22:07 +02:00
parent 68bf718285
commit 3c08c748b4
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -90,7 +90,7 @@ class RoombaBot:
room_id = parts[2]
await self.shutdown_room(room_id, purge)
elif event.body.startswith("!roomba "):
elif event.body and event.body.split()[0] == "!roomba":
await self.send_message(
self.moderation_room_id,
"Unknown command. Use '!roomba block <room_id>', '!roomba unblock <room_id>', or '!roomba shutdown <room_id> [--purge]'.",