🐛 Fix: bot.call_api 在被 called api hook mock 后应该忽略 exception (#2374)

Co-authored-by: Ju4tCode <42488585+yanyongyu@users.noreply.github.com>
This commit is contained in:
Ailitonia
2023-09-25 11:02:50 +08:00
committed by GitHub
parent ede1a20c53
commit 60e0752f1a
2 changed files with 155 additions and 0 deletions

View File

@ -106,7 +106,10 @@ class Bot(abc.ABC):
logger.debug("Running CalledAPI hooks...")
await asyncio.gather(*coros)
except MockApiException as e:
# mock api result
result = e.result
# ignore exception
exception = None
logger.debug(
f"Calling API {api} result is mocked. Return {result} instead."
)