Fix indexes of capture groups

${{0}} now means the whole match and ${{1}} is the first capture group.
This commit is contained in:
Tulir Asokan 2021-07-18 19:41:33 +03:00
parent 28d6b05913
commit 873cae5821

View file

@ -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)