mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 08:12:14 +08:00
Fix bug of handle_cancellation()
This commit is contained in:
parent
ab4d12d214
commit
635fc70756
@ -10,7 +10,7 @@ def handle_cancellation(session: CommandSession):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def control(value):
|
def control(value):
|
||||||
if _is_cancellation(value):
|
if _is_cancellation(value) is True:
|
||||||
session.finish(render_expression(
|
session.finish(render_expression(
|
||||||
session.bot.config.SESSION_CANCEL_EXPRESSION))
|
session.bot.config.SESSION_CANCEL_EXPRESSION))
|
||||||
return value
|
return value
|
||||||
@ -18,7 +18,7 @@ def handle_cancellation(session: CommandSession):
|
|||||||
return control
|
return control
|
||||||
|
|
||||||
|
|
||||||
async def _is_cancellation(sentence: str) -> bool:
|
def _is_cancellation(sentence: str) -> bool:
|
||||||
for kw in ('算', '别', '不', '停', '取消'):
|
for kw in ('算', '别', '不', '停', '取消'):
|
||||||
if kw in sentence:
|
if kw in sentence:
|
||||||
# a keyword matches
|
# a keyword matches
|
||||||
|
Loading…
Reference in New Issue
Block a user