Fix bug of handle_cancellation()

This commit is contained in:
Richard Chien 2019-02-21 22:20:31 +08:00
parent ab4d12d214
commit 635fc70756

View File

@ -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