Giter Club home page Giter Club logo

adapter-qq's Introduction

nonebot-adapter-qq

NoneBot-Adapter-QQ

✨ QQ 协议适配 ✨

配置

修改 NoneBot 配置文件 .env 或者 .env.*

Driver

参考 driver 配置项,添加 HTTPClientWebSocketClient 支持。

如:

DRIVER=~httpx+~websockets
DRIVER=~aiohttp

QQ_IS_SANDBOX

是否为沙盒模式,默认为 False

QQ_IS_SANDBOX=true

QQ_BOTS

配置机器人帐号 id token secret,intent 需要根据机器人类型以及需要的事件进行配置。

Intent

以下为所有 Intent 配置项以及默认值:

{
  "guilds": true,
  "guild_members": true,
  "guild_messages": false,
  "guild_message_reactions": true,
  "direct_message": false,
  "open_forum_event": false,
  "audio_live_member": false,
  "c2c_group_at_messages": false,
  "interaction": false,
  "message_audit": true,
  "forum_event": false,
  "audio_action": false,
  "at_messages": true
}

示例

私域频道机器人示例

QQ_BOTS='
[
  {
    "id": "xxx",
    "token": "xxx",
    "secret": "xxx",
    "intent": {
      "guild_messages": true,
      "at_messages": false
    }
  }
]
'

公域群机器人示例

QQ_BOTS='
[
  {
    "id": "xxx",
    "token": "xxx",
    "secret": "xxx",
    "intent": {
      "c2c_group_at_messages": true
    }
  }
]
'

adapter-qq's People

Contributors

17theword avatar ailitonia avatar cmhopesunshine avatar cypas avatar dependabot[bot] avatar dreamail avatar felinae98 avatar he0119 avatar iris7656 avatar kimigaiiwuyi avatar mingxuangame avatar mobyw avatar old-dream321 avatar pre-commit-ci[bot] avatar rf-tar-railt avatar ssttkkl avatar starhearthunt avatar xapenny avatar yanyongyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adapter-qq's Issues

请求适配消息撤回事件

这个事件本身对我没什么用处, 但是无法解析这个事件导致经常报错.
( 或者有什么办法让它忽略这个事件吗

03-15 12:15:09 [WARNING] nonebot | QQ Guild | Failed to parse event Dispatch(opcode=<Opcode.DISPATCH: 0>, data={'message': {'author': {'bot': False, 'id': '537106425******', 'username': '白昼梦游指北'}, 'channel_id': '246******', 'guild_id': '74010238******', 'id': '089890b6fbf3fdedda6610b887db75385b4******'}, 'op_user': {'id': '5371064253******'}}, sequence=2, type='MESSAGE_DELETE', id='MESSAGE_DELETE:9ef1e775-de71-4cc2-8e48-ddf366adb680')
Traceback (most recent call last):
  File "/home/Nonebot/bot.py", line 29, in <module>
    nonebot.run(app="__mp_main__:app")
  File "/usr/local/lib/python3.10/dist-packages/nonebot/__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/nonebot/drivers/fastapi.py", line 187, in run
    uvicorn.run(
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 569, in run
    server.run()
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
> File "/usr/local/lib/python3.10/dist-packages/nonebot/adapters/qqguild/adapter.py", line 216, in _forward_ws
    event = self.payload_to_event(payload)
  File "/usr/local/lib/python3.10/dist-packages/nonebot/adapters/qqguild/adapter.py", line 303, in payload_to_event
    event = Event.parse_obj(payload.data)
  File "/usr/local/lib/python3.10/dist-packages/pydantic/main.py", line 526, in parse_obj
    return cls(**obj)
TypeError: Can't instantiate abstract class Event with abstract method get_type
03-15 12:15:09 [WARNING] nonebot | QQ Guild | Unknown payload type: PUBLIC_MESSAGE_DELETE
03-15 12:15:09 [WARNING] nonebot | QQ Guild | Failed to parse event Dispatch(opcode=<Opcode.DISPATCH: 0>, data={'message': {'author': {'bot': False, 'id': '5371064253740******', 'username': '白昼梦游指北'}, 'channel_id': '2468******', 'guild_id': '74010238******', 'id': '089890b6fbf3fdedda6610b887db75385b488******'}, 'op_user': {'id': '5371064253******'}}, sequence=3, type='PUBLIC_MESSAGE_DELETE', id='PUBLIC_MESSAGE_DELETE:e92b1aef-995a-472a-9a0c-f83b446b2720')
Traceback (most recent call last):
  File "/home/Nonebot/bot.py", line 29, in <module>
    nonebot.run(app="__mp_main__:app")
  File "/usr/local/lib/python3.10/dist-packages/nonebot/__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/nonebot/drivers/fastapi.py", line 187, in run
    uvicorn.run(
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 569, in run
    server.run()
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
> File "/usr/local/lib/python3.10/dist-packages/nonebot/adapters/qqguild/adapter.py", line 216, in _forward_ws
    event = self.payload_to_event(payload)
  File "/usr/local/lib/python3.10/dist-packages/nonebot/adapters/qqguild/adapter.py", line 303, in payload_to_event
    event = Event.parse_obj(payload.data)
  File "/usr/local/lib/python3.10/dist-packages/pydantic/main.py", line 526, in parse_obj
    return cls(**obj)
TypeError: Can't instantiate abstract class Event with abstract method get_type

日志中中的ID被我去掉了

谢谢!

event.get_plaintext()函数获取到的文本最好进行解码

image
上方为nb日志输出的接受到的c2c聊天消息,显示为&
下方为event.get_plaintext()函数获取到的文本,&符号未解码,获取到的值为&
日志输出和event.get_plaintext()函数获取到的值建议相同,排查也不好查

nb端无法接收到q群或者q私聊信息

环境

ubuntu == 22.04
python == 3.10.12,
nb-cli ==1.4.1
nonebot2 == 2.3.1
通过nb adapter方式安装本插件
nonebot-adapter-qq == 1.4.4

问题/步骤

在q.qq.com新建机器人,确定全局权限,沙盒模式和非沙盒模式都试过;
nonebot端正常设置env,图如下,在启动nb的时候也输出了正确连接到的log,但是群里艾特的信息和私聊信息均没有在nonebot端收到,但是qq频道的测试频道是正常收发信息的。

image

env

image

群消息不需要转义 <>

别的没测,直接把

return s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
给替换成原封不动返回了。

修改之前:
<> 被转义为 &lt; &gt;,群没转义回来,频道正常

修改之后:
没转义,群正常,频道正常,但是我加的额外 logger 炸了(因为把 <> 以为是颜色符号

image

无法连接至QQ - SSL证书验证失效

我尝试在Python 3.11.6运行NoneBot Adapter QQ,但是框架报错“SSL证书验证失败”(GPT分析)
框架版本:nb-cli 1.2.6
操作系统已关闭防火墙并开放所有出入站规则
错误如下:

11-17 20:46:37 [ERROR] nonebot | QQ | Failed to get gateway info.
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\aiohttp\connector.py", line 980, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1112, in create_connection
transport, protocol = await self._create_connection_transport(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1145, in _create_connection_transport
await waiter
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\sslproto.py", line 575, in _on_handshake_complete
raise handshake_exc
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\sslproto.py", line 557, in _do_handshake
self._sslobj.do_handshake()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 979, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\adapters\qq\bot.py", line 461, in _request
response = await self.adapter.request(request)
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\internal\adapter\adapter.py", line 90, in request
return await self.driver.request(setup)
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\drivers\aiohttp.py", line 73, in request
async with session.request(
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\aiohttp\client.py", line 1167, in aenter
self._resp = await self._coro
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\aiohttp\client.py", line 562, in _request
conn = await self._connector.connect(
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\aiohttp\connector.py", line 540, in connect
proto = await self._create_connection(req, traces, timeout)
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\aiohttp\connector.py", line 901, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\aiohttp\connector.py", line 1209, in _create_direct_connection
raise last_exc
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\aiohttp\connector.py", line 1178, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\aiohttp\connector.py", line 982, in _wrap_create_connection
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.sgroup.qq.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "", line 15, in
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot_init_.py", line 331, in run
get_driver().run(*args, **kwargs)
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\drivers\none.py", line 70, in run
loop.run_until_complete(self._serve())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 640, in run_until_complete
self.run_forever()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 607, in run_forever
self._run_once()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1922, in _run_once
handle._run()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
》 File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\adapters\qq\adapter.py", line 105, in run_bot
gateway_info = await bot.shard_url_get()
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\internal\adapter\bot.py", line 123, in call_api
raise exception
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\internal\adapter\bot.py", line 98, in call_api
result = await self.adapter._call_api(self, api, **data)
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\adapters\qq\adapter.py", line 416, in _call_api
return await api_handler(bot, **data)
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\adapters\qq\utils.py", line 64, in call
return await self.func(inst, *args, **kwds)
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\adapters\qq\bot.py", line 1507, in shard_url_get
return parse_obj_as(ShardUrlGetReturn, await self._request(request))
File "C:\Users\Administrator\Desktop\SPS_Bot.venv\Lib\site-packages\nonebot\adapters\qq\bot.py", line 463, in _request
raise NetworkError("API request failed") from e
nonebot.adapters.qq.exception.NetworkError:

GPT输出
此为GPT输出的结果,而我在另一台电脑上能正常使用
另一台电脑的框架版本:nb-cli 1.2.5
是否是nb-cli的版本问题导致QQ适配器不兼容?

补充一下:我尝试检查SSL库,发现两主机的库均为2023.07.22(即最新版)
正在尝试指定nb.exe的出入站规则...

请问报错Received invalid session event from server. Try to reconnect...怎么办

启动机器人后始终报错Received invalid session event from server. Try to reconnect...
频道机器人

05-25 12:57:33 [SUCCESS] nonebot | NoneBot is initializing...
05-25 12:57:33 [INFO] nonebot | Current Env: dev
05-25 12:57:33 [DEBUG] nonebot | Loaded Config: {'driver': '~httpx+~websockets', 'host': IPv4Address('127.0.0.1'), 'port': 8080, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': set(), 'nickname': set(), 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'qq_is_sandbox': True, 'qq_bots': [{'id': 'xxx', 'token': 'xxx', 'secret': 'xxx', 'intent': {'guild_messages': True, 'at_messages': False}}], 'environment': 'dev'}
05-25 12:57:34 [DEBUG] nonebot | Succeeded to load adapter "QQ"
05-25 12:57:34 [DEBUG] nonebot | OneBot V12 | Model for key "" <class 'nonebot.adapters.onebot.v12.event.BotEvent'> is overridden by <class 'nonebot.adapters.onebot.v12.event.Event'>
05-25 12:57:35 [SUCCESS] nonebot | Succeeded to load plugin "综合" from "src.综合"
05-25 12:57:35 [SUCCESS] nonebot | Running NoneBot...
05-25 12:57:35 [DEBUG] nonebot | Loaded adapters: QQ
05-25 12:57:35 [DEBUG] nonebot | QQ | QQ run in sandbox mode: True
05-25 12:57:35 [DEBUG] nonebot | QQ | QQ api base url: https://sandbox.api.sgroup.qq.com
05-25 12:57:35 [INFO] nonebot | Application startup completed.
05-25 12:57:35 [DEBUG] nonebot | QQ | Bot 102113039 calling API shard_url_get
05-25 12:57:35 [DEBUG] nonebot | QQ | WebSocket Connection to wss://sandbox.api.sgroup.qq.com/websocket established
05-25 12:57:35 [WARNING] nonebot | QQ | Received invalid session event from server. Try to reconnect...
05-25 12:57:38 [DEBUG] nonebot | QQ | WebSocket Connection to wss://sandbox.api.sgroup.qq.com/websocket established
05-25 12:57:38 [WARNING] nonebot | QQ | Received invalid session event from server. Try to reconnect...
05-25 12:57:41 [DEBUG] nonebot | QQ | WebSocket Connection to wss://sandbox.api.sgroup.qq.com/websocket established
05-25 12:57:42 [WARNING] nonebot | QQ | Received invalid session event from server. Try to reconnect...
05-25 12:57:45 [DEBUG] nonebot | QQ | WebSocket Connection to wss://sandbox.api.sgroup.qq.com/websocket established
05-25 12:57:45 [WARNING] nonebot | QQ | Received invalid session event from server. Try to reconnect...
05-25 12:57:48 [DEBUG] nonebot | QQ | WebSocket Connection to wss://sandbox.api.sgroup.qq.com/websocket established
05-25 12:57:48 [WARNING] nonebot | QQ | Received invalid session event from server. Try to reconnect...
05-25 12:57:51 [DEBUG] nonebot | QQ | WebSocket Connection to wss://sandbox.api.sgroup.qq.com/websocket established
05-25 12:57:51 [WARNING] nonebot | QQ | Received invalid session event from server. Try to reconnect...

Bug: 群机器人无法正常发送语音

发送使用MessageSegment.audio(audio_url)发送silk格式语音失败并报错
<ActionFailed: 500, code=850019, message=不支持的文件格式, trace_id=xxx>

下载图片出现问题

图片地址:https://wenxin.baidu.com/younger/file/ERNIE-ViLG/39d9837486e58bd78e74798e56017a535q

代码:

from nonebot import on_command
from nonebot.adapters.qqguild import MessageSegment

matcher = on_command("test")


@matcher.handle()
async def _():
    msg = MessageSegment.image("https://wenxin.baidu.com/younger/file/ERNIE-ViLG/39d9837486e58bd78e74798e56017a535q")
    await matcher.finish(msg)

报错:

08-26 19:01:43 [ERROR] nonebot | Running matcher <Matcher from drawer_bot.plugins.test, type=message, priority=1, temp=False> failed.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\tsing\miniconda3\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "c:\users\tsing\miniconda3\lib\multiprocessing\spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
  File "c:\users\tsing\miniconda3\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "c:\users\tsing\miniconda3\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "c:\users\tsing\miniconda3\lib\site-packages\uvicorn\_subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "c:\users\tsing\miniconda3\lib\site-packages\uvicorn\server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "c:\users\tsing\miniconda3\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "c:\users\tsing\miniconda3\lib\asyncio\base_events.py", line 634, in run_until_complete
    self.run_forever()
  File "c:\users\tsing\miniconda3\lib\asyncio\base_events.py", line 601, in run_forever
    self._run_once()
  File "c:\users\tsing\miniconda3\lib\asyncio\base_events.py", line 1905, in _run_once
    handle._run()
  File "c:\users\tsing\miniconda3\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\message.py", line 146, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\message.py", line 196, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\internal\matcher.py", line 672, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\internal\matcher.py", line 639, in simple_run
    await handler(
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\dependencies\__init__.py", line 92, in __call__
    return await self.call(**values)
  File "J:\myProject\机器人\nonebot2\drawer-bot\.\drawer_bot\plugins\test\__init__.py", line 10, in _
    await matcher.finish(msg)
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\internal\matcher.py", line 468, in finish
    await cls.send(message, **kwargs)
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\internal\matcher.py", line 453, in send
    return await bot.send(event=event, message=_message, **kwargs)
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\adapters\qqguild\bot.py", line 144, in send
    return await self.post_messages(
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\internal\adapter\bot.py", line 117, in call_api
    raise exception
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\internal\adapter\bot.py", line 94, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\adapters\qqguild\adapter.py", line 312, in _call_api
    return await api_handler(self, bot, **data)
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\adapters\qqguild\api\handle.py", line 275, in _post_messages
    return parse_obj_as(Message, await _request(adapter, bot, request))
  File "c:\users\tsing\miniconda3\lib\site-packages\nonebot\adapters\qqguild\api\request.py", line 34, in _request
    raise ActionFailed(data)
nonebot.adapters.qqguild.exception.ActionFailed: <ActionFailed: 500, code=40004, message=file not allow download, data=None>

无法启动

'''

Attempting uninstall: nonebot2
Found existing installation: nonebot2 2.0.0
Uninstalling nonebot2-2.0.0:
Successfully uninstalled nonebot2-2.0.0
Successfully installed nonebot-adapter-qq-1.0.0 nonebot2-2.1.1 typing-extensions-4.8.0
WARNING: You are using pip version 20.2.3; however, version 23.2.1 is available.
You should consider upgrading via the '/usr/local/py/bin/python3.8 -m pip install --upgrade pip' command.
[root@RainYun-H6oVCZwf Chiyuki-Bot]# py bot.py
10-03 18:20:19 [SUCCESS] nonebot | NoneBot is initializing...
10-03 18:20:19 [INFO] nonebot | Current Env: prod
Traceback (most recent call last):
File "bot.py", line 21, in
app = nonebot.get_asgi()
File "/usr/local/py/lib/python3.8/site-packages/nonebot/init.py", line 190, in get_asgi
assert isinstance(
AssertionError: asgi object is only available for asgi driver
'''

配置好参数后启动后Bot(type='QQ Guild', self_id='*******') not found in adapter QQ Guild

在安装好此适配器并且在nonebot加载适配器 然后配置好QQGUILD_BOTS等参数后启动nb会一直出现error

08-08 12:36:46 [DEBUG] nonebot | QQ Guild | WebSocket Connection to wss://api.sgroup.qq.com/websocket established
08-08 12:36:46 [ERROR] nonebot | QQ Guild | Error while process data from websocket wss://api.sgroup.qq.com/websocket. Trying to reconnect...
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "D:\Code\Python\python310\lib\site-packages\nonebot\__init__.py", line 309, in run
    get_driver().run(*args, **kwargs)
  File "D:\Code\Python\python310\lib\site-packages\nonebot\drivers\none.py", line 71, in run
    loop.run_until_complete(self._serve())
  File "D:\Code\Python\python310\lib\asyncio\base_events.py", line 628, in run_until_complete
    self.run_forever()
  File "D:\Code\Python\python310\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "D:\Code\Python\python310\lib\asyncio\base_events.py", line 595, in run_forever
    self._run_once()
  File "D:\Code\Python\python310\lib\asyncio\base_events.py", line 1881, in _run_once
    handle._run()
  File "D:\Code\Python\python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
> File "D:\Code\Python\python310\lib\site-packages\nonebot\adapters\qqguild\adapter.py", line 157, in _forward_ws
    result = await self._authenticate(bot, ws, shard)
  File "D:\Code\Python\python310\lib\site-packages\nonebot\adapters\qqguild\adapter.py", line 269, in _authenticate
    assert isinstance(
AssertionError: Received unexpected payload: InvalidSession(opcode=<Opcode.INVALID_SESSION: 9>, d=False)
08-08 12:36:46 [ERROR] nonebot | QQ Guild | Error while setup websocket to wss://api.sgroup.qq.com/websocket. Trying to reconnect...
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "D:\Code\Python\python310\lib\site-packages\nonebot\__init__.py", line 309, in run
    get_driver().run(*args, **kwargs)
  File "D:\Code\Python\python310\lib\site-packages\nonebot\drivers\none.py", line 71, in run
    loop.run_until_complete(self._serve())
  File "D:\Code\Python\python310\lib\asyncio\base_events.py", line 628, in run_until_complete
    self.run_forever()
  File "D:\Code\Python\python310\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "D:\Code\Python\python310\lib\asyncio\base_events.py", line 595, in run_forever
    self._run_once()
  File "D:\Code\Python\python310\lib\asyncio\base_events.py", line 1881, in _run_once
    handle._run()
  File "D:\Code\Python\python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
> File "D:\Code\Python\python310\lib\site-packages\nonebot\adapters\qqguild\adapter.py", line 190, in _forward_ws
    self.bot_disconnect(bot)
  File "D:\Code\Python\python310\lib\site-packages\nonebot\internal\adapter\adapter.py", line 70, in bot_disconnect
    raise RuntimeError(f"{bot} not found in adapter {self.get_name()}")
RuntimeError: Bot(type='QQ Guild', self_id='******') not found in adapter QQ Guild

[QQ群] 无法在接受消息指令时获取图片信息

环境

  • ubuntu
  • python3.10

详情

/测试 文字 (指令+文字没有问题)
/测试 [图片] (指令+图片报错)

报错如下所示

02-26 18:15:36 [WARNING] nonebot | QQ | Failed to parse event Dispatch(opcode=<Opcode.DISPATCH: 0>, data={'attachments': [{'content_type': 'image/jpeg', 'filename': 'CE56D93217731BCC87C554FA8AD7A8FF.jpg', 'height': 168, 'size': 3512, 'url': 'https://gchat.qpic.cn/gchatpic_new/761708854/761708854-2990635440-CE56D93217731BCC87C554FA8AD7A8FF/0?vuin=435826135&term=0&is_origin=2&is_ntv2=1', 'width': 138}], 'author': {'id': '73070094761266F31B985FB05EC75710', 'member_openid': '73070094761266F31B985FB05EC75710'}, 'content': ' /龙图 ', 'group_id': 'A9FA4B8E24CCD4DD6D18D0FAB2414F6A', 'group_openid': 'A9FA4B8E24CCD4DD6D18D0FAB2414F6A', 'id': 'ROBOT1.0_xQB7jM.LuoOeNiKmZ2M2af85kASWKlAQTpTuQyWbnX6rZVo5MJ16MNAABO7jRGuqgl.Qvlkq1iu9tB-Qgg2ZuA!!', 'timestamp': '2024-02-26T18:15:35+08:00'}, sequence=3, type='GROUP_AT_MESSAGE_CREATE', id='GROUP_AT_MESSAGE_CREATE:xqb7jmluooenikmz2m2acce6zlwjvfsrurvcnuhurruv957wseidnfe0ixfc6s')
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/projects/nobot2/bot.py", line 66, in <module>
    nonebot.run()
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/__init__.py", line 333, in run
    get_driver().run(*args, **kwargs)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/drivers/none.py", line 56, in run
    loop.run_until_complete(self._serve())
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/adapters/qq/adapter.py", line 181, in _forward_ws
    await self._loop(bot, ws)
> File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/adapters/qq/adapter.py", line 346, in _loop
    event = self.payload_to_event(payload)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/adapters/qq/adapter.py", line 410, in payload_to_event
    return type_validate_python(EventClass, payload.data)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/compat.py", line 202, in type_validate_python
    return TypeAdapter(type_).validate_python(data)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/pydantic/type_adapter.py", line 256, in validate_python
    return self.validator.validate_python(__object, strict=strict, from_attributes=from_attributes, context=context)
pydantic_core._pydantic_core.ValidationError: 3 validation errors for GroupAtMessageCreateEvent
attachments.0.height
  Input should be a valid string [type=string_type, input_value=168, input_type=int]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type
attachments.0.width
  Input should be a valid string [type=string_type, input_value=138, input_type=int]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type
attachments.0.size
  Input should be a valid string [type=string_type, input_value=3512, input_type=int]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type

Bot无法启动

在最下面加载消息之后不再加载消息,导致无法启动

Microsoft Windows [版本 10.0.20348.1366]
(c) Microsoft Corporation。保留所有权利。

C:\Users\Lsrl>cd nb

C:\Users\Lsrl\nb>nb run
使用 Python: C:\Users\Lsrl\nb\.venv\Scripts\python.exe
10-08 21:25:36 [SUCCESS] nonebot | NoneBot is initializing...
10-08 21:25:36 [INFO] nonebot | Current Env: prod
10-08 21:25:36 [SUCCESS] nonebot | Succeeded to load plugin "echo" from "nonebot.plugins.echo"
10-08 21:25:37 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_picmcstat"
10-08 21:25:37 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
10-08 21:25:37 [INFO] nonebot_plugin_admin | 已检测到软依赖nonebot_plugin_apscheduler, 开启定时任务功能
10-08 21:25:38 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_admin"
10-08 21:25:38 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alias"
10-08 21:25:38 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_crazy_thursday"
C:\Users\Lsrl\nb\.venv\lib\site-packages\fuzzywuzzy\fuzz.py:11: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
  warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
10-08 21:25:38 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_PicMenu"
10-08 21:25:38 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_russian"
10-08 21:25:39 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
10-08 21:25:41 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_memes"
10-08 21:25:41 [INFO] nonebot_plugin_steam_game_status | steam_web_key 读取成功
10-08 21:25:41 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_steam_game_status"
10-08 21:25:42 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_datastore"
10-08 21:25:42 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_chatrecorder"
10-08 21:25:42 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_wordcloud"
10-08 21:25:42 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_who_at_me"
10-08 21:25:42 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_follow_withdraw"
10-08 21:25:42 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_picstatus"
10-08 21:25:43 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlrender"
10-08 21:25:43 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_bawiki"
10-08 21:25:43 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_guild_patch"
10-08 21:25:43 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_dialectlist"
10-08 21:25:43 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
10-08 21:25:43 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_saa"
10-08 21:25:43 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_capoo"
10-08 21:25:43 [SUCCESS] nonebot | Running NoneBot...
10-08 21:25:43 [INFO] nonebot_plugin_apscheduler | Scheduler Started
10-08 21:25:47 [WARNING] nonebot_plugin_crazy_thursday | Abort downloading
10-08 21:25:47 [INFO] nonebot_plugin_memes | 正在检查资源文件...
10-08 21:25:47 [INFO] nonebot_plugin_datastore | 数据库初始化完成
10-08 21:25:48 [INFO] nonebot_plugin_htmlrender | 使用 chromium 启动
10-08 21:25:48 [INFO] nonebot_plugin_htmlrender | Browser Started.
10-08 21:25:48 [INFO] nonebot_plugin_capoo | 配置项未选择本地存储图片,将通过url发送图片
10-08 21:25:48 [INFO] nonebot | Application startup completed.

发送QQ群消息时无法发送图片

使用bot.send发送QQ群消息时如果message为

message = MessagSegment.text("测试")+MessageSegment.file_image

则会报错

TypeError: Bot.post_group_messages() got an unexpected keyword argument 'file_image'

机器人无法发送多张图片

测试代码:

image_count = wenxin_config.wenxin_image_count # 图片数量
        msg = Message(f'文心原创绘画:主题为“{text}”的{style}') 
        for i in range(image_count): 
            msg += MessageSegment.image(images[i]['image'])
        await matcher.finish(msg)

效果:
在正常使用时(onebot11适配器)可以发送文字 + 多张图片,QQ频道适配器调用同样的代码只能发送出文字 + 第一张。

适配器每30min自动重连

image
image
适配器每30min都会自动断开连接并进行重连,会影响正在处理的matcher,与腾讯服务器的ws自动重连可否在适配器内部完成

不能启动

.env规定Env=Prod
.env.prod规定
DRIVER=~httpx+~websockets
但是启动提示

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\bot\adengnb\.venv\Lib\site-packages\nonebot\drivers\fastapi.py", line 38, in <module>
    import uvicorn
ModuleNotFoundError: No module named 'uvicorn'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "C:\Users\Administrator\Desktop\bot\adengnb\.venv\Lib\site-packages\nonebot\__init__.py", line 318, in init
    DriverClass = _resolve_combine_expr(config.driver)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\Desktop\bot\adengnb\.venv\Lib\site-packages\nonebot\__init__.py", line 254, in _resolve_combine_expr
    DriverClass = resolve_dot_notation(
                  ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\Desktop\bot\adengnb\.venv\Lib\site-packages\nonebot\utils.py", line 264, in resolve_dot_notation
    module = importlib.import_module(modulename)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\Users\Administrator\Desktop\bot\adengnb\.venv\Lib\site-packages\nonebot\drivers\fastapi.py", line 43, in <module>
    raise ImportError(
ImportError: Please install FastAPI first to use this driver. Install with pip: `pip install nonebot2[fastapi]`

安装后启动项目又提示这个
RuntimeError: Current driver ~fastapi does not support http client requests! QQ Adapter need a HTTPClient Driver to work.

后续我又尝试了aiohttp,但问题依然没有解决

无法发送表情消息

私域机器人,频道用echo可输出表情
但在群里的回复就是@夜笙等不到晚安 <faceType=1,faceId="338",ext="eyJ0ZXh0Ijoi5oiR5oOz5byA5LqGIn0="><faceType=1,faceId="338",ext="eyJ0ZXh0Ijoi5oiR5oOz5byA5LqGIn0="><faceType=1,faceId="338",ext="eyJ0ZXh0Ijoi5oiR5oOz5byA5LqGIn0=">
@夜笙等不到晚安 <faceType=1,faceId="337",ext="eyJ0ZXh0Ijoi6Iqx5py16IS4In0=">
类似于这种的了

qq频道适配器安装失败

nb adapter install nonebot-adapter-qqguild

好像是并未发布这个包,我在商店看见的 https://v2.nonebot.dev/store

$ nb adapter install nonebot-adapter-qqguild

DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
ERROR: Could not find a version that satisfies the requirement nonebot-adapter-qqguild (from versions: none)
ERROR: No matching distribution found for nonebot-adapter-qqguild

Feature: 转换QQ频道消息

由于频道的消息序列化存在N多的问题,暂时无法将频道消息转换为nb内部消息来进行command匹配等操作

等待官方重新设计内嵌格式或者其他解决方案(2021年12月提出的问题至今未给出)

启动后没有登录到QQ频道Bot

在根据文档填写.env后,启动Bot没有显示登录信息,显示如下:

10-09 13:35:44 [DEBUG] nonebot | Succeeded to load adapter "QQ Guild"
10-09 13:35:44 [SUCCESS] nonebot | Succeeded to load plugin "echo" from "nonebot.plugins.echo"
10-09 13:35:44 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_jrrp2" from "src.plugins.nonebot_plugin_jrrp2"
10-09 13:35:44 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
10-09 13:35:46 [DEBUG] nonebot_plugin_datastore | 创建数据库文件夹: /root/.local/share/nonebot2
10-09 13:35:46 [DEBUG] nonebot_plugin_datastore | 数据库连接地址: sqlite+aiosqlite:////root/.local/share/nonebot2/data.db
10-09 13:35:46 [DEBUG] nonebot_plugin_datastore | 数据库引擎参数: {'echo': False, 'echo_pool': False}
10-09 13:35:46 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_datastore"
10-09 13:35:47 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_saa"
10-09 13:35:47 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_emojimix"
10-09 13:35:47 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_session"
10-09 13:35:49 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_minesweeper"
10-09 13:35:49 [SUCCESS] nonebot | Running NoneBot...
10-09 13:35:49 [DEBUG] nonebot | Loaded adapters: OneBot V11, QQ Guild
10-09 13:35:49 [INFO] uvicorn | Started server process [1603389]
10-09 13:35:49 [INFO] uvicorn | Waiting for application startup.
10-09 13:35:49 [DEBUG] nonebot | QQ Guild | QQ Guild run in sandbox mode: False
10-09 13:35:49 [DEBUG] nonebot | QQ Guild | QQ Guild api base url: https://api.sgroup.qq.com/
10-09 13:35:50 [DEBUG] nonebot_plugin_datastore | 初始化插件 nonebot_plugin_session 的数据库
10-09 13:35:50 [INFO] nonebot_plugin_datastore | 数据库初始化完成
10-09 13:35:50 [INFO] uvicorn | Application startup complete.
10-09 13:35:50 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:8082 (Press CTRL+C to quit)``


.env中的内容:

ENVIRONMENT=dev
DRIVER=~fastapi+~httpx+~websockets+~aiohttp
QQ_BOTS='
[
  {
    "id": "隐藏",
    "token": "隐藏",
    "secret": "隐藏",
    "intent": {
      "guild_messages": true,
      "at_messages": false
    }
  }
]
'

建议火速适配最新群发富媒体消息api端点

关于【机器人发送图片失败】问题处理情况说明
尊敬的各位参赛开发者们:
关于富媒体消息接口更新导致机器人发送图片失败的问题,目前平台已修复。其中主要有以下两个接口更新点需要大家重点关注:
1)两个发消息接口
/v2/groups/{group_openid}/messages,/v2/users/{openid}/messages
新增 msg_type = 7 类型,用作发送富媒体消息,新增 media 字段作为发送内容参数,可结合 msg_id 和 msg_seq 字段使用被动消息的能力。
8279ca053fc7b292c823cce381416a24

  1. 两个富媒体消息接口
    /v2/users/{openid}/files,/v2/groups/{group_openid}/files
    更新使用协议机制
    当请求参数字段 srv_send_msg 设置为 true,会当作【主动消息】直接发送到对应场景,超频会发送失败{"message":"msg limit exceed","code":22009},
    设置成 false 时,请求返回数据用作上述 media 字段作为入参参数内容,开发者可选择使用主动或被动的方式发送到具体的用户或群。
03e4aafe2895ad2d5791ccc1cba779d8

另外如遇其它问题,也欢迎大家联系我们反馈,给大家造成的不便,敬请谅解。目前大赛期间,问题咨询及反馈相对较多,希望大家多多理解,耐心等待。
@全体成员

频道发送markdown消息报错

频道发送markdown消息时,会出现错误如下
nonebot.adapters.qq.exception.ActionFailed: <ActionFailed: 500, code=304041, message=reply messageg not allow markdown, trace_id=xxxxx>
频道应该发送md消息时不为reply

无法登录到群Bot

安装adapter-qq后运行nb run显示如下内容:
11-10 05:18:32 [DEBUG] nonebot | Succeeded to load adapter "QQ"
11-10 05:18:32 [DEBUG] nonebot | Succeeded to load adapter "Minecraft"
11-10 05:18:32 [SUCCESS] nonebot | Succeeded to load plugin "uniseg" from "nonebot_plugin_alconna.uniseg"
11-10 05:18:32 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna"
11-10 05:18:33 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_status"
11-10 05:18:33 [SUCCESS] nonebot | Running NoneBot...
11-10 05:18:33 [DEBUG] nonebot | Loaded adapters: QQ, Minecraft
11-10 05:18:34 [INFO] uvicorn | Started server process [837869]
11-10 05:18:34 [INFO] uvicorn | Waiting for application startup.
11-10 05:18:34 [DEBUG] nonebot | QQ Guild | QQ run in sandbox mode: True
11-10 05:18:34 [DEBUG] nonebot | QQ Guild | QQ api base url: https://sandbox.api.sgroup.qq.com
11-10 05:18:34 [DEBUG] nonebot | QQ Guild | Bot 3889000112 calling API shard_url_get
11-10 05:18:34 [INFO] uvicorn | Application startup complete.
11-10 05:18:34 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit)
11-10 05:18:34 [ERROR] nonebot | QQ Guild | Failed to get gateway info.
Traceback (most recent call last):
File "", line 19, in
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/init.py", line 331, in run
get_driver().run(*args, **kwargs)
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/drivers/fastapi.py", line 201, in run
uvicorn.run(
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/uvicorn/main.py", line 587, in run
server.run()
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/uvicorn/server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)

File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/adapters/qq/adapter.py", line 105, in run_bot
gateway_info = await bot.shard_url_get()
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/internal/adapter/bot.py", line 123, in call_api
raise exception
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/internal/adapter/bot.py", line 98, in call_api
result = await self.adapter._call_api(self, api, **data)
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/adapters/qq/adapter.py", line 415, in _call_api
return await api_handler(bot, **data)
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/adapters/qq/utils.py", line 64, in call
return await self.func(inst, *args, **kwds)
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/adapters/qq/bot.py", line 1508, in shard_url_get
return parse_obj_as(ShardUrlGetReturn, await self._request(request))
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/adapters/qq/bot.py", line 459, in _request
request.headers.update(await self.get_authorization_header())
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/adapters/qq/bot.py", line 266, in get_authorization_header
headers = {"Authorization": await self._get_authorization_header()}
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/adapters/qq/bot.py", line 261, in _get_authorization_header
return f"QQBot {await self.get_access_token()}"
File "/home/bot/xt/rootfs/home/NightWind-qq/.venv/lib/python3.8/site-packages/nonebot/adapters/qq/bot.py", line 252, in get_access_token
self._access_token = cast(str, data["access_token"])
KeyError: 'access_token'

.env文件如下:

NVIRONMENT=dev
DRIVER=~fastapi+~httpx+~websockets+~aiohttp

QQ_BOTS='
[
{
"id": "3xxxxxxxx2",
"token": "mxxxxxxxxxxxxxxxxxxxDu",
"secret": "zxxxxxxxxxxxxxx8J",
"intent": {
"c2c_group_at_messages": true
}
}
]
'

# Bug(?)

在频道中发消息,机器人接收到消息后对频道好友广播了一遍,号秒封
2c707502bf28772f

Bug:echo插件无作用

消息内容如下:
image

有确定收到ws消息:(pc上有\xa0,手机为空格)
image

from nonebot.rule import to_me
from nonebot.adapters import Message
from nonebot.params import CommandArg
from nonebot.plugin import on_command

echo = on_command("echo",to_me())


@echo.handle()
async def echo_escape(message: Message = CommandArg()):
    await echo.send(message=message)

好像是 to_me() 的问题 不艾特就可以

可以考虑暴露更多的Api

我在使用中发现,连post_message这样一个常用的Api也需要call_api才行

希望开发者可以暴露更多的常用Api给我们

(如果已经有了那当我没说)

Bug: 群机器人无法使用沙箱频道

当在.env文件中将 c2c_group_at_messages 设置为true后,在沙箱频道触发指令会有以下报错

File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot_plugin_handle/__init__.py", line 207, in handle_handle
    await send(f"你有{game.times}次机会猜一个四字成语,请发送成语", game.draw())
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot_plugin_handle/__init__.py", line 190, in send
    await bot.send(event,msg)
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 415, in send
    return await self.send_to_channel(
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 326, in send_to_channel
    return await self.post_messages(
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/internal/adapter/bot.py", line 123, in call_api
    raise exception
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/internal/adapter/bot.py", line 98, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/adapters/qq/adapter.py", line 415, in _call_api
    return await api_handler(bot, **data)
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/adapters/qq/utils.py", line 64, in __call__
    return await self.func(inst, *args, **kwds)
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 918, in post_messages
    return parse_obj_as(GuildMessage, await self._request(request))
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 488, in _request
    raise ex from None
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 486, in _request
    return self._handle_response(response)
  File "/home/dmc/.envs/guild/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 450, in _handle_response
    raise UnauthorizedException(response)
nonebot.adapters.qq.exception.UnauthorizedException: <ActionFailed: 401, code=11200, message=parse appid err, data=None>

只有设置"public_guild_messages":true ,删除c2c_group_at_messages配置,才能正常向频道内发送消息

使用 `Bot` 基类发送文本消息错误

示例

from nonebot.adapters import Bot, Event, Message
from nonebot.adapters.qq import MessageSegment

@best50.handle()
async def _(bot: Bot, event: Event, arg: Message = CommandArg()):
    
    """代码处理"""

    data: Union[BytesIO, str] = test()

    if isinstance(data, BytesIO):
        msg = MessageSegment.file_image(data)
    else:
        msg = data
    print(msg)
    await bot.send(event, msg, reply_message=True)

报错:

找到此玩家请确保此玩家的用户名和查分器中的用户名相同如未绑定请前往查分器官网进行绑定
https://www.diving-fish.com/maimaidx/prober/
10-24 21:42:03 [INFO] nonebot | Matcher(type='message', module=src.plugins.nonebot-plugin-maimaidx.nonebot_plugin_maimaidx, lineno=70) running complete
10-24 21:42:03 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.nonebot-plugin-maimaidx.nonebot_plugin_maimaidx, lineno=70) failed.
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\Users\Yuzu\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module>
    cli.main()
  File "c:\Users\Yuzu\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
    run()
  File "c:\Users\Yuzu\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "c:\Users\Yuzu\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "c:\Users\Yuzu\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "c:\Users\Yuzu\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "C:\sakurabot\bot.py", line 15, in <module>
    nonebot.run()
  File "C:\Program Files\Python38\lib\site-packages\nonebot\__init__.py", line 331, in run
    get_driver().run(*args, **kwargs)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\drivers\fastapi.py", line 201, in run
    uvicorn.run(
  File "C:\Program Files\Python38\lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\Program Files\Python38\lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Program Files\Python38\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "C:\Program Files\Python38\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 570, in run_forever
    self._run_once()
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 1859, in _run_once
    handle._run()
  File "C:\Program Files\Python38\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "C:\Program Files\Python38\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\internal\matcher\matcher.py", line 846, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\internal\matcher\matcher.py", line 821, in simple_run
    await handler(
  File "C:\Program Files\Python38\lib\site-packages\nonebot\dependencies\__init__.py", line 113, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\sakurabot\src\plugins\nonebot-plugin-maimaidx\nonebot_plugin_maimaidx\__init__.py", line 635, in _
    await bot.send(event, msg, reply_message=True)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\adapters\qq\bot.py", line 411, in send
    return await self.send_to_channel(
  File "C:\Program Files\Python38\lib\site-packages\nonebot\adapters\qq\bot.py", line 322, in send_to_channel
    return await self.post_messages(
  File "C:\Program Files\Python38\lib\site-packages\nonebot\internal\adapter\bot.py", line 123, in call_api
    raise exception
  File "C:\Program Files\Python38\lib\site-packages\nonebot\internal\adapter\bot.py", line 98, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\adapters\qq\adapter.py", line 415, in _call_api
    return await api_handler(bot, **data)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\adapters\qq\utils.py", line 64, in __call__
    return await self.func(inst, *args, **kwds)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\adapters\qq\bot.py", line 914, in post_messages
    return parse_obj_as(GuildMessage, await self._request(request))
  File "C:\Program Files\Python38\lib\site-packages\nonebot\adapters\qq\bot.py", line 463, in _request
    return self._handle_response(response)
  File "C:\Program Files\Python38\lib\site-packages\nonebot\adapters\qq\bot.py", line 452, in _handle_response
    raise ActionFailed(response)
nonebot.adapters.qq.exception.ActionFailed: <ActionFailed: 403, code=304003, message=url not allowed, data=None>

datastr 类型的时候,正常应该是使用发送消息的API发送文本消息,但还是使用了发送图片消息的参数,如果 dataBytesIO 使用 MessageSegment.file_image() 发送图片是正常的

无法连接

已确认appid token secret填写正确 尝试过重置token 仍无法正常链接
日志如下

03-14 12:52:37 [SUCCESS] nonebot | NoneBot is initializing...
03-14 12:52:37 [INFO] nonebot | Current Env: dev
03-14 12:52:37 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi+~websockets+~httpx', 'host': IPv4Address('127.0.0.1'), 'port': 9090, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': set(), 'nickname': set(), 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'fastapi_reload': False, 'qqguild_bots': [{'id': '102****21', 'token': 'V7S******f7neEM', 'secret': 'bA******xxiJfr', 'intent': {'guild_messages': True, 'at_messages': False}}], 'environment': 'dev'}
03-14 12:52:38 [DEBUG] nonebot | Succeeded to load adapter "QQ Guild"
03-14 12:52:39 [SUCCESS] nonebot | Succeeded to import "echo"
03-14 12:52:39 [SUCCESS] nonebot | Running NoneBot...
03-14 12:52:39 [DEBUG] nonebot | Loaded adapters: QQ Guild
03-14 12:52:39 [INFO] uvicorn | Started server process [9408]
03-14 12:52:39 [INFO] uvicorn | Waiting for application startup.
03-14 12:52:39 [DEBUG] nonebot | QQ Guild | QQ Guild run in sandbox mode: False
03-14 12:52:39 [DEBUG] nonebot | QQ Guild | QQ Guild api base url: https://api.sgroup.qq.com/
03-14 12:52:39 [DEBUG] nonebot | QQ Guild | Calling API shard_url_get
03-14 12:52:39 [INFO] uvicorn | Application startup complete.
03-14 12:52:39 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:9090 (Press CTRL+C to quit)
03-14 12:52:40 [DEBUG] nonebot | QQ Guild | WebSocket Connection to wss://api.sgroup.qq.com/websocket established
03-14 12:52:40 [INFO] nonebot | QQ Guild | Bot 102041021 connected
03-14 12:52:40 [ERROR] nonebot | QQ Guild | Received invalid session event from server. Try to reconnect...
03-14 12:52:43 [DEBUG] nonebot | QQ Guild | WebSocket Connection to wss://api.sgroup.qq.com/websocket established
03-14 12:52:43 [INFO] nonebot | QQ Guild | Bot 102041021 connected
03-14 12:52:43 [ERROR] nonebot | QQ Guild | Received invalid session event from server. Try to reconnect...
03-14 12:52:46 [DEBUG] nonebot | QQ Guild | WebSocket Connection to wss://api.sgroup.qq.com/websocket established
03-14 12:52:46 [INFO] nonebot | QQ Guild | Bot 102041021 connected
03-14 12:52:46 [ERROR] nonebot | QQ Guild | Received invalid session event from server. Try to reconnect...
03-14 12:52:47 [INFO] uvicorn | Shutting down
03-14 12:52:47 [INFO] uvicorn | Waiting for application shutdown.
03-14 12:52:47 [INFO] uvicorn | Application shutdown complete.
03-14 12:52:47 [INFO] uvicorn | Finished server process [9408]

无法转换频道私聊信息为一个Event

10-21 18:02:08 [WARNING] nonebot | QQ Guild | Failed to parse event Dispatch(opcode=<Opcode.DISPATCH: 0>, data={'author': {'avatar': 'https://qqchannel-profile-1251316161.file.myqcloud.com/16533256150e7147ab420eceb66?t=1653325650', 'id': '16362846582326858170', 'username': 'kkkkkk'}, 'channel_id': '210451697880338', 'content': 'q', 'direct_message': True, 'guild_id': '13595572922435876753', 'id': '0891efd6fda5b1cbd6bc0110929ac7d5f9ec2f3804489fc3cea906', 'member': {'joined_at': '2023-10-21T17:25:38+08:00'}, 'seq': 4, 'seq_in_channel': '4', 'src_guild_id': '7088881514225344423', 'timestamp': '2023-10-21T18:02:07+08:00'}, sequence=5, type='DIRECT_MESSAGE_CREATE', id='DIRECT_MESSAGE_CREATE:0891efd6fda5b1cbd6bc0110929ac7d5f9ec2f3804489fc3cea906')
Traceback (most recent call last):
  File "D:\code\py\bot\bot.py", line 18, in <module>
    nonebot.run()
  File "C:\Users\A\.conda\envs\botenv\lib\site-packages\nonebot\__init__.py", line 331, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\A\.conda\envs\botenv\lib\site-packages\nonebot\drivers\none.py", line 70, in run
    loop.run_until_complete(self._serve())
  File "C:\Users\A\.conda\envs\botenv\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\A\.conda\envs\botenv\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\A\.conda\envs\botenv\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\A\.conda\envs\botenv\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "C:\Users\A\.conda\envs\botenv\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\A\.conda\envs\botenv\lib\site-packages\nonebot\adapters\qq\adapter.py", line 180, in _forward_ws
    await self._loop(bot, ws)
> File "C:\Users\A\.conda\envs\botenv\lib\site-packages\nonebot\adapters\qq\adapter.py", line 344, in _loop
    event = self.payload_to_event(payload)
  File "C:\Users\A\.conda\envs\botenv\lib\site-packages\nonebot\adapters\qq\adapter.py", line 407, in payload_to_event
    return EventClass.parse_obj(payload.data)
  File "pydantic\main.py", line 526, in pydantic.main.BaseModel.parse_obj
    return cls(**obj)
  File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
    raise validation_error
pydantic.error_wrappers.ValidationError: 1 validation error for DirectMessageCreateEvent
member -> roles
  field required (type=value_error.missing)

配置如下:
DRIVER=~fastapi+~websockets+~httpx
DRIVER=~aiohttp
QQ_IS_SANDBOX=false
QQ_BOTS='
[
{
"id": "?",
"token": "?",
"secret": "?",
"intent": {
"guild_messages": true,
"at_messages": false,
"direct_message": true
}
}
]
'

Q:如何使用这个适配器

下面是启动报错

07-24 23:55:24 [ERROR] nonebot | QQ Guild | Error while process data from websocket wss://sandbox.api.sgroup.qq.com/websocket. Trying to reconnect...
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/__init__.py", line 333, in run
    get_driver().run(*args, **kwargs)
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 70, in run
    loop.run_until_complete(self._serve())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
> File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/adapters/qqguild/adapter.py", line 151, in _forward_ws
    result = await self._authenticate(bot, ws, shard)
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/adapters/qqguild/adapter.py", line 251, in _authenticate
    assert isinstance(
AssertionError: Received unexpected payload: InvalidSession(opcode=<Opcode.INVALID_SESSION: 9>, d=False)
07-24 23:55:24 [ERROR] nonebot | QQ Guild | Error while setup websocket to wss://sandbox.api.sgroup.qq.com/websocket. Trying to reconnect...
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/__init__.py", line 333, in run
    get_driver().run(*args, **kwargs)
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 70, in run
    loop.run_until_complete(self._serve())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
> File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/adapters/qqguild/adapter.py", line 180, in _forward_ws
    self.bot_disconnect(bot)
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/internal/adapter/adapter.py", line 70, in bot_disconnect
    raise RuntimeError(f"{bot} not found in adapter {self.get_name()}")
RuntimeError: Bot(type='QQ Guild', self_id=删除) not found in adapter QQ Guild
^C07-24 23:55:26 [INFO] nonebot | Shutting down
07-24 23:55:26 [INFO] nonebot | Waiting for application shutdown.
Shutting down process [140750]...
07-24 23:55:26 [INFO] nonebot | Application shutdown complete.
Stopped reloader.

文件树

➜  universal_bot tree
.
├── adapter-qqguild.config.backup
├── pyproject.toml
├── README.md
└── src
    └── plugins

3 directories, 3 files
➜  universal_bot 
➜  universal_bot cat .env
ENVIRONMENT=dev
DRIVER=~aiohttp



QQGUILD_IS_SANDBOX=true
QQGUILD_BOTS='
[
  {
    "id": "删除",
    "token": "删除",
    "secret": 删除",
    "intent": {
      "guild_messages": true,
      "at_messages": false
    }
  }
]
'

配置QQ 频道 协议时遇到如下错误

ERROR: Could not find a version that satisfies the requirement nonebot-adapter-qqguild (from versions: none)
ERROR: No matching distribution found for nonebot-adapter-qqguild

使用

nb adapter install nonebot-adapter-qqguild

也不行

Vscode 调试启动与 Windows终端启动问题

测试环境:Windows 11
Python版本:python 3.8 和 python 3.11

需要做插件测试如果用Vscode启动的话 pydantic 无法验证 qq_bots 这个值,如下图
{835D3C9A-D84D-4567-8674-852A8FEF0892}

但是用windows终端启动的话是一切正常的
{508420B5-AFF6-43b9-8BFE-3C449608E43A}

是否可以验证一下,虽然是个小问题

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.