Fix expression render

This commit is contained in:
Richard Chien 2018-07-25 23:02:43 +08:00
parent 545f9e840b
commit 086ac57c21

View File

@ -15,7 +15,7 @@ def render(expr: Union[str, Sequence[str], Callable], *, escape_args=True,
:return: the rendered message
"""
if isinstance(expr, Callable):
expr = expr()
expr = expr(**kwargs)
elif isinstance(expr, Sequence) and not isinstance(expr, str):
expr = random.choice(expr)
if escape_args: