`Traceback (most recent call last):
File "C:\Python37\lib\site-packages\quart\asgi.py", line 201, in call
Running on http://127.0.0.1:9700 (CTRL + C to quit)
await self.app.startup()
File "C:\Python37\lib\site-packages\quart\app.py", line 2081, in startup
await func()
File "D:/project/GitHub/scumlogs-master/Qbot.py", line 46, in test
await bot.send_private_msg(user_id=ownerQID, message='test')
File "C:\Python37\lib\site-packages\aiocqhttp_init_.py", line 207, in call_action
return await self._api.call_action(action=action, **params)
File "C:\Python37\lib\site-packages\aiocqhttp\api_impl.py", line 199, in call_action
raise ApiNotAvailable
aiocqhttp.exceptions.ApiNotAvailable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/project/GitHub/scumlogs-master/Qbot.py", line 49, in
bot.run(host = '127.0.0.1', port = 9700)
File "C:\Python37\lib\site-packages\aiocqhttp_init_.py", line 200, in run
self.server_app.run(host=host, port=port, *args, **kwargs)
File "C:\Python37\lib\site-packages\quart\app.py", line 1613, in run
loop.run_until_complete(task)
File "C:\Python37\lib\asyncio\base_events.py", line 583, in run_until_complete
return future.result()
File "C:\Python37\lib\site-packages\hypercorn\asyncio_init.py", line 39, in serve
await worker_serve(app, config, shutdown_trigger=shutdown_trigger)
File "C:\Python37\lib\site-packages\hypercorn\asyncio\run.py", line 66, in worker_serve
raise exception
File "C:\Python37\lib\site-packages\hypercorn\asyncio\lifespan.py", line 30, in handle_lifespan
await invoke_asgi(self.app, scope, self.asgi_receive, self.asgi_send)
File "C:\Python37\lib\site-packages\hypercorn\utils.py", line 203, in invoke_asgi
await app(scope, receive, send)
File "C:\Python37\lib\site-packages\quart\app.py", line 2051, in call
await self.asgi_app(scope, receive, send)
File "C:\Python37\lib\site-packages\quart\app.py", line 2074, in asgi_app
await asgi_handler(receive, send)
File "C:\Python37\lib\site-packages\quart\asgi.py", line 203, in call
await send({"type": "lifespan.startup.failed", "message": str(error)})
File "C:\Python37\lib\site-packages\hypercorn\asyncio\lifespan.py", line 77, in asgi_send
raise LifespanFailure("startup", message["message"])
hypercorn.utils.LifespanFailure: Lifespan failure in startup. `
試試加上 @bot._server_app.before_serving,然後移除調用 test() 那一行。
@bot._server_app.before_serving
async def test():
# 略 ...
if __name__ == "__main__":
bot.run(...)
报了这样的错误