MoRan23 / GZCTF-BOT-QQ

GZCTF对接的qq机器人,基于NapCat+Nonebot框架
https://blog.moran233.xyz
GNU Affero General Public License v3.0
21 stars 2 forks source link

使用docker-compose部署时遇见 apscheduler 的报错 #1

Closed LinYuanyi1 closed 2 months ago

LinYuanyi1 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

MoRan23 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

第一个问题在你没有连接napcatqq之前是正常会报错的,第二个的话,请问你的docker-compose配置文件是怎样的

LinYuanyi1 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

第一个问题在你没有连接napcatqq之前是正常会报错的,第二个的话,请问你的docker-compose配置文件是怎样的

这是我的配置文件,我将监听比赛部分置空希望能监听所有比赛。还想请问第一个问题中如果napcat报错,但我还是正常扫码登录qq后没有得到定时的赛事播报该如何解决,或者说如何先napcat登录再链接bot

QQ20240905-163246@2x
MoRan23 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

第一个问题在你没有连接napcatqq之前是正常会报错的,第二个的话,请问你的docker-compose配置文件是怎样的

这是我的配置文件,我将监听比赛部分置空希望能监听所有比赛。还想请问第一个问题中如果napcat报错,但我还是正常扫码登录qq后没有得到定时的赛事播报该如何解决,或者说如何先napcat登录再链接bot

QQ20240905-163246@2x

顺序是无所谓的,赛事播报是需要自己开启的,我先看看你的配置

MoRan23 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

第一个问题在你没有连接napcatqq之前是正常会报错的,第二个的话,请问你的docker-compose配置文件是怎样的

这是我的配置文件,我将监听比赛部分置空希望能监听所有比赛。还想请问第一个问题中如果napcat报错,但我还是正常扫码登录qq后没有得到定时的赛事播报该如何解决,或者说如何先napcat登录再链接bot

QQ20240905-163246@2x

可以用管理员账号访问一下/api/edit/games/1/challenges接口把结果给我看一下吗?

LinYuanyi1 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

第一个问题在你没有连接napcatqq之前是正常会报错的,第二个的话,请问你的docker-compose配置文件是怎样的

这是我的配置文件,我将监听比赛部分置空希望能监听所有比赛。还想请问第一个问题中如果napcat报错,但我还是正常扫码登录qq后没有得到定时的赛事播报该如何解决,或者说如何先napcat登录再链接bot

QQ20240905-163246@2x

顺序是无所谓的,赛事播报是需要自己开启的,我先看看你的配置

这是得到的结果

image
MoRan23 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

第一个问题在你没有连接napcatqq之前是正常会报错的,第二个的话,请问你的docker-compose配置文件是怎样的

这是我的配置文件,我将监听比赛部分置空希望能监听所有比赛。还想请问第一个问题中如果napcat报错,但我还是正常扫码登录qq后没有得到定时的赛事播报该如何解决,或者说如何先napcat登录再链接bot

QQ20240905-163246@2x

顺序是无所谓的,赛事播报是需要自己开启的,我先看看你的配置

这是得到的结果 image

这是未登录

LinYuanyi1 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

第一个问题在你没有连接napcatqq之前是正常会报错的,第二个的话,请问你的docker-compose配置文件是怎样的

这是我的配置文件,我将监听比赛部分置空希望能监听所有比赛。还想请问第一个问题中如果napcat报错,但我还是正常扫码登录qq后没有得到定时的赛事播报该如何解决,或者说如何先napcat登录再链接bot

QQ20240905-163246@2x

顺序是无所谓的,赛事播报是需要自己开启的,我先看看你的配置

这是得到的结果 image

这是未登录

啊抱歉,这是新的结果

image
MoRan23 commented 2 months ago

我在使用docker-compose时遇见了一些问题,apscheduler在get_bot时找不到当前的bot,报错如下

gzctf-bot-qq-bot-1  | 09-05 06:19:42 [ERROR] apscheduler | Job "_ (trigger: interval[0:00:20], next run at: 2024-09-05 14:20:02 CST)" raised an exception
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1226, in _
gzctf-bot-qq-bot-1  |     bot = get_bot()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 230, in get_bot
gzctf-bot-qq-bot-1  |     raise ValueError("There are no bots to get.")
gzctf-bot-qq-bot-1  | ValueError: There are no bots to get.

而且在使用命令/qa时,似乎数据类型方面也有问题

gzctf-bot-qq-bot-1  | 09-05 06:21:01 [ERROR] nonebot | Running Matcher(type='message', module=gzctf-bot.plugins.gzctf_bot_qq.main_bot, lineno=122) failed.
gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
gzctf-bot-qq-bot-1  |     await _run_matcher(
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
gzctf-bot-qq-bot-1  |     await matcher.run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
gzctf-bot-qq-bot-1  |     await self.simple_run(bot, event, state, stack, dependency_cache)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
gzctf-bot-qq-bot-1  |     await handler(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
gzctf-bot-qq-bot-1  |     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 928, in qa_handle
gzctf-bot-qq-bot-1  |     challenges = getChallenges(gameInfo['id'])
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/all_tools.py", line 204, in getChallenges
gzctf-bot-qq-bot-1  |     allChallenges.sort(key=lambda x: (x["tag"], x["isEnabled"]))
gzctf-bot-qq-bot-1  | AttributeError: 'dict' object has no attribute 'sort'

请问如何修复呢

第一个问题在你没有连接napcatqq之前是正常会报错的,第二个的话,请问你的docker-compose配置文件是怎样的

这是我的配置文件,我将监听比赛部分置空希望能监听所有比赛。还想请问第一个问题中如果napcat报错,但我还是正常扫码登录qq后没有得到定时的赛事播报该如何解决,或者说如何先napcat登录再链接bot

QQ20240905-163246@2x

顺序是无所谓的,赛事播报是需要自己开启的,我先看看你的配置

这是得到的结果 image

这是未登录

啊抱歉,这是新的结果 image

看起来是没问题的,但是我重新构建了一下,麻烦删除本地的registry.cn-hangzhou.aliyuncs.com/moran233/nn:GZBOT镜像重新拉取再试一下

LinYuanyi1 commented 2 months ago

/api/edit/games/1/challenges

后续我在重新拉取后,尝试发布通知,但bot定时的msgContent似乎没有得到对应的值导致没办法实现定时播报。 报错信息如下

gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1246, in _
gzctf-bot-qq-bot-1  |     msgContent = newNotice['values']
gzctf-bot-qq-bot-1  | KeyError: 'values'
MoRan23 commented 2 months ago

/api/edit/games/1/challenges

后续我在重新拉取后,尝试发布通知,但bot定时的msgContent似乎没有得到对应的值导致没办法实现定时播报。 报错信息如下

gzctf-bot-qq-bot-1  | Traceback (most recent call last):
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/bot.py", line 17, in <module>
gzctf-bot-qq-bot-1  |     nonebot.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
gzctf-bot-qq-bot-1  |     get_driver().run(*args, **kwargs)
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
gzctf-bot-qq-bot-1  |     uvicorn.run(
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
gzctf-bot-qq-bot-1  |     server.run()
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
gzctf-bot-qq-bot-1  |     return asyncio.run(self.serve(sockets=sockets))
gzctf-bot-qq-bot-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
gzctf-bot-qq-bot-1  |     return loop.run_until_complete(main)
gzctf-bot-qq-bot-1  | > File "/usr/local/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
gzctf-bot-qq-bot-1  |     retval = await job.func(*job.args, **job.kwargs)
gzctf-bot-qq-bot-1  |   File "/root/GZCTF-BOT-QQ/gzctf-bot/plugins/gzctf_bot_qq/main_bot.py", line 1246, in _
gzctf-bot-qq-bot-1  |     msgContent = newNotice['values']
gzctf-bot-qq-bot-1  | KeyError: 'values'

加我qq好交流1677984022