关于 matcher.reject
是否有全局强制中断方法。
#43
Answered
by
yanyongyu
nanshaobit
asked this question in
问答
-
例如,我注册了很多 想了解一下,除了在每个函数内提示用户输入q 并判断,有无更优的解决方案。 多谢~ |
Beta Was this translation helpful? Give feedback.
Answered by
yanyongyu
Oct 14, 2021
Replies: 1 comment
-
你可以写一个 async def allow_cancel(bot: Bot, event: Event, state: T_State):
"""An args parser allows to finish the session."""
message = str(event.get_message())
if message == "取消":
await bot.send(event, "已取消")
raise FinishedException
state[state["_current_key"]] = str(event.get_message()) 并在matcher中注册 matcher.args_parser(allow_cancel) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
nanshaobit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
你可以写一个
args_parser
并在其中进行退出判断调用finish
来进行退出并在matcher中注册