nonebot / adapter-satori

NoneBot2 Satori 适配器 / Satori Protocol adapter for nonebot2
MIT License
82 stars 4 forks source link

[Bug]: QQ群消息中user_id等同于guild_id #23

Closed EnchantedHay closed 1 month ago

EnchantedHay commented 1 month ago

确认项

操作系统

Windows

Python 版本

3.10

NoneBot 版本

2.3.1

适配器

0.11.5

协议端

Chronocat 0.2.10

描述问题

接收群消息事件时,用户id与群组id相同,为群组id的值。

复现步骤

正常启动最新版QQNT(9.9.11)+LiteloaderQQNT(1.1.1)+Chronocat(0.2.10),成功连接nonebot

期望的结果

No response

截图或日志

一次启动例:

(nonebot2) D:\Desktop\pytech\bot\haybot>python bot.py
06-05 13:15:07 [SUCCESS] nonebot | NoneBot is initializing...
06-05 13:15:07 [INFO] nonebot | Current Env: prod
06-05 13:15:07 [SUCCESS] nonebot | Succeeded to load plugin "echo" from "nonebot.plugins.echo"
06-05 13:15:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
06-05 13:15:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_session"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_session_orm"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_chatrecorder"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "dead_or_not" from "src.plugins.dead_or_not"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "random_dice" from "src.plugins.random_dice"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "bible_game" from "src.plugins.bible_game"
06-05 13:15:10 [SUCCESS] nonebot | Succeeded to load plugin "yiyan_ernie" from "src.plugins.yiyan_ernie"
06-05 13:15:10 [SUCCESS] nonebot | Running NoneBot...
06-05 13:15:10 [INFO] nonebot_plugin_orm | 没有检测到新的升级操作
06-05 13:15:10 [INFO] nonebot | Application startup completed.
06-05 13:15:12 [INFO] nonebot | Satori | Bot 172****019 connected
06-05 13:15:39 [SUCCESS] nonebot | Satori 172****019 | [message-created]: Message 7376883****15935406 from ChanceLetHay(371****187)@[NostalgicCover:371****187]: [Text(type='text', data={'text': '搞什么', 'styles': {}}, _children=[])]
06-05 13:15:41 [SUCCESS] nonebot | Satori 172****019 | [message-created]: Message 7376883****08027905 from (371****187)@[NostalgicCover:371****187]: [Text(type='text', data={'text': '我怎么也没看明白', 'styles': {}}, _children=[])]

log

Nonebot 配置项

DRIVER=~aiohttp
RF-Tar-Railt commented 1 month ago

chronocat那边的控制台显示的消息记录是什么样子的

EnchantedHay commented 1 month ago

chronocat那边的控制台显示的消息记录是什么样子的

Chronocat这边是正确的,例如下面同一段聊天记录:

Chronocat:

[2019][06-05 18:18:19][M][CH0000] NostalgicCover(371***187)-Nameless(211***4731): [回复1619***740] 谢邀我穿的短袖
[2019][06-05 18:18:25][M][CH0000] NostalgicCover(371***187)-Nameless(211***4731): 我已经觉得我没命在了

Nonebot:

06-05 18:18:19 [SUCCESS] nonebot | Satori 172****019 | [message-created]: Message 737696***062460713 from Nameless(371***187)@[NostalgicCover:371***187]: [Text(type='text', data={'text': '谢邀我穿的短袖', 'styles': {}}, _children=[])]
06-05 18:18:25 [SUCCESS] nonebot | Satori 172****019 | [message-created]: Message 737691***337650273 from Nameless(371***187)@[NostalgicCover:371***187]: [Text(type='text', data={'text': '我已经觉得我没命在了', 'styles': {}}, _children=[])]
RF-Tar-Railt commented 1 month ago

看了一下,只是事件描述的代码写错了,实际从事件拿到的还是正确的

class PublicMessageCreatedEvent(MessageCreatedEvent, PublicMessageEvent):
    @override
    def get_event_description(self) -> str:
        return escape_tag(
            f"Message {self.msg_id} from "
            f"{self.user.name or ''}({self.channel.id})"
            f"@[{self.channel.name or ''}:{self.channel.id}]"
            f": {self.get_message()!r}"
        )