From 9b3dffaab974d2b9360ca415bbbc27b4223e0dbc Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Mon, 9 Nov 2020 16:34:14 +0800 Subject: [PATCH] :alembic: add prompt format support --- nonebot/matcher.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nonebot/matcher.py b/nonebot/matcher.py index f4f67245..92238af9 100644 --- a/nonebot/matcher.py +++ b/nonebot/matcher.py @@ -260,7 +260,8 @@ class Matcher(metaclass=MatcherMeta): state["_current_key"] = key if key not in state: if prompt: - await bot.send(event=event, message=prompt) + await bot.send(event=event, + message=str(prompt).format(**state)) raise PausedException else: state["_skip_key"] = True @@ -535,7 +536,8 @@ class MatcherGroup: state["_current_key"] = key if key not in state: if prompt: - await bot.send(event=event, message=prompt) + await bot.send(event=event, + message=str(prompt).format(state)) raise PausedException else: state["_skip_key"] = True