Browse Source

add support for forced commands (best effort)

Kirk Trombley 1 year ago
parent
commit
2e7925ae69
2 changed files with 6 additions and 1 deletions
  1. 5 1
      rollbot/rollbot/bot.py
  2. 1 0
      rollbot/rollbot/types.py

+ 5 - 1
rollbot/rollbot/bot.py

@@ -50,7 +50,11 @@ class Rollbot(Generic[RawMsg]):
 
         message.command = Command.from_text(message.text)
         if message.command is None or message.command.bang not in self.command_config.bangs:
-            return
+            if not message.force_command:
+                return
+            message.command = Command.from_text(self.command_config.bangs[0] + message.text)
+            if message.command is None:
+                return
 
         command = self.command_config.aliases.get(message.command.name, message.command.name)
         await self.on_command(incoming, message, command)

+ 1 - 0
rollbot/rollbot/types.py

@@ -42,6 +42,7 @@ class Message:
     message_id: str | None = None
     received_at: float = field(default_factory=time.time)
     command: Command | None = None
+    force_command: bool = False
 
 
 @dataclass