From 3900b04dba7483003c8bd374429da8414bb5412d Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 23 Jun 2019 12:14:15 +0300 Subject: [PATCH] Allow non-string variables --- reactbot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactbot.py b/reactbot.py index c1812ee..41f7de9 100644 --- a/reactbot.py +++ b/reactbot.py @@ -111,6 +111,9 @@ class Template: def _replace_variables(tpl: str, variables: Dict[str, Any]) -> str: for match in variable_regex.finditer(tpl): val = variables[match.group(1)] + if match.start() == 0 and match.end() == len(tpl): + # Whole field is a single variable, just return the value to allow non-string types. + return val tpl = tpl[:match.start()] + val + tpl[match.end():] return tpl