mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-09-21 05:12:34 +00:00
Fix possible bug
This commit is contained in:
parent
d822ddbcaa
commit
62eb4510a4
@ -438,18 +438,18 @@ async def _real_run_command(session: CommandSession,
|
|||||||
res = await session.cmd.run(session, **kwargs)
|
res = await session.cmd.run(session, **kwargs)
|
||||||
raise _FinishException(res)
|
raise _FinishException(res)
|
||||||
except _FurtherInteractionNeeded:
|
except _FurtherInteractionNeeded:
|
||||||
|
session.running = False
|
||||||
if disable_interaction:
|
if disable_interaction:
|
||||||
# if the command needs further interaction, we view it as failed
|
# if the command needs further interaction, we view it as failed
|
||||||
return False
|
return False
|
||||||
logger.debug(f'Further interaction needed for '
|
logger.debug(f'Further interaction needed for '
|
||||||
f'command {session.cmd.name}')
|
f'command {session.cmd.name}')
|
||||||
session.running = False
|
|
||||||
# return True because this step of the session is successful
|
# return True because this step of the session is successful
|
||||||
return True
|
return True
|
||||||
except _FinishException as e:
|
except _FinishException as e:
|
||||||
logger.debug(f'Session of command {session.cmd.name} finished')
|
|
||||||
session.running = False
|
session.running = False
|
||||||
if not disable_interaction:
|
logger.debug(f'Session of command {session.cmd.name} finished')
|
||||||
|
if ctx_id in _sessions:
|
||||||
# the command is finished, remove the session
|
# the command is finished, remove the session
|
||||||
del _sessions[ctx_id]
|
del _sessions[ctx_id]
|
||||||
return e.result
|
return e.result
|
||||||
|
Loading…
Reference in New Issue
Block a user