From 873cae58211c919fd9361c6e962b0c874d2ff0bf Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 18 Jul 2021 19:41:33 +0300 Subject: [PATCH] Fix indexes of capture groups ${{0}} now means the whole match and ${{1}} is the first capture group. --- reactbot/rule.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactbot/rule.py b/reactbot/rule.py index f7703d2..b97b350 100644 --- a/reactbot/rule.py +++ b/reactbot/rule.py @@ -59,7 +59,8 @@ class Rule: async def execute(self, evt: MessageEvent, match: Match) -> None: extra_vars = { - **{str(i): val for i, val in enumerate(match.groups())}, + "0": match.group(0), + **{str(i+1): val for i, val in enumerate(match.groups())}, **match.groupdict(), } content = self.template.execute(evt=evt, rule_vars=self.variables, extra_vars=extra_vars)