diff --git a/reactbot/bot.py b/reactbot/bot.py index 1016312..6281e4f 100644 --- a/reactbot/bot.py +++ b/reactbot/bot.py @@ -106,4 +106,5 @@ class ReactBot(Plugin): await rule.execute(evt, match) except Exception: self.log.exception(f"Failed to execute {name} in {evt.room_id}") - + if not rule.continue_after_match: + return diff --git a/reactbot/config.py b/reactbot/config.py index b264a6b..a8b11bb 100644 --- a/reactbot/config.py +++ b/reactbot/config.py @@ -64,6 +64,7 @@ class Config(BaseProxyConfig): type=EventType.find(rule["type"]) if "type" in rule else None, template=self.templates[rule["template"]], variables=self._parse_variables(rule), + continue_after_match=rule.get("continue_after_match", True), ) except Exception as e: raise ConfigError(f"Failed to load {name}") from e diff --git a/reactbot/rule.py b/reactbot/rule.py index 07e714d..cff295a 100644 --- a/reactbot/rule.py +++ b/reactbot/rule.py @@ -35,6 +35,7 @@ class Rule: template: Template type: Optional[EventType] variables: Dict[str, Any] + continue_after_match: bool def _check_not_match(self, body: str) -> bool: for pattern in self.not_matches: