mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
Fix a bug
This commit is contained in:
parent
8e877b6cd3
commit
f31baf4623
@ -516,12 +516,18 @@ async def _real_run_command(session: CommandSession,
|
||||
timeout = None
|
||||
if session.bot.config.SESSION_RUN_TIMEOUT:
|
||||
timeout = session.bot.config.SESSION_RUN_TIMEOUT.total_seconds()
|
||||
|
||||
try:
|
||||
await asyncio.wait_for(future, timeout)
|
||||
raise _FinishException(future.result())
|
||||
handled = future.result()
|
||||
except asyncio.TimeoutError:
|
||||
# if timeout happens, we think the session is finished
|
||||
raise _FinishException(True)
|
||||
# if timeout happens, absolutely the command was executed (but may not finished)
|
||||
handled = True
|
||||
except Exception as e:
|
||||
# if any other exception happens, the command was executed but failed
|
||||
logger.exception(e)
|
||||
handled = True
|
||||
raise _FinishException(handled)
|
||||
except _FurtherInteractionNeeded:
|
||||
session.running = False
|
||||
if disable_interaction:
|
||||
|
Loading…
Reference in New Issue
Block a user