NapNeko / NapCatQQ

现代化的基于 NTQQ 的 Bot 协议端实现
https://napcat.napneko.icu
Other
2.54k stars 178 forks source link

[BUG] 自身事件上报Event中没有消息 #536

Closed Murphy08 closed 4 hours ago

Murphy08 commented 5 hours ago

系统版本

Windows 10

QQNT 版本

9.9.16-29725

NapCat 版本

V4.0.3

OneBot 客户端

OneBot V11+ Nonebot2

发生了什么?

接收message_sent自身上报消息,event内容缺失

如何复现

这是代码

test = on("message_sent")

@test.handle()
async def test_handler(event: Event):
    for k, v in vars(event).items():
        print(k, v)

日志:

2024-11-17 10:29:21 [debug] 墨非(1075442383) | 收到新消息 RawMessage {"msgId":"7438069728086821042","msgRandom":"1892400119","msgSeq":"10406","cntSeq":"0","chatType":2,"msgType":2,"subMsgType":1,"sendType":2,"senderUid":"u_w-pYhRO13Mivo7fnSgxd0g","peerUid":"294056628","channelId":"","guildId":"","guildCode":"0","fromUid":"0","fromAppid":"0","msgTime":"1731810562","msgMeta":{},"sendStatus":2,"sendRemarkName":"","sendMemberName":"","sendNickName":"墨非","guildName":"","channelName":"","elements":[{"elementType":1,"elementId":"7438069728086821041","elementGroupId":0,"extBufForUI":{},"textElement":{"content":"测试","atType":0,"atUid":"0","atTinyId":"0","atNtUid":"","subElementType":0,"atChannelId":"0","linkInfo":null,"atRoleId":"0","atRoleColor":0,"atRoleName":"","needNotify":0},"faceElement":null,"marketFaceElement":null,"replyElement":null,"picElement":null,"pttElement":null,"videoElement":null,"grayTipElement":null,"arkElement":null,"fileElement":null,"liveGiftElement":null,"markdownElement":null,"structLongMsgElement":null,"multiForwardMsgElement":null,"giphyElement":null,"walletElement":null,"inlineKeyboardElement":null,"textGiftElement":null,"calendarElement":null,"yoloGameResultElement":null,"avRecordElement":null,"structMsgElement":null,"faceBubbleElement":null,"shareLocationElement":null,"tofuRecordElement":null,"taskTopMsgElement":null,"recommendedMsgElement":null,"actionBarElement":null,"prologueMsgElement":null}],"records":[],"emojiLikesList":[],"commentCnt":"0","directMsgFlag":0,"directMsgMembers":[],"peerName":"测试启承国际","freqLimitInfo":null,"editable":true,"avatarMeta":"","avatarPendant":"","feedId":"","roleId":"0","timeStamp":"0","clientIdentityInfo":null,"isImportMsg":false,"atType":0,"roleType":0,"fromChannelRoleInfo":{"roleId":"0","name":"","color":0},"fromGuildRoleInfo":{"roleId":"0","name":"","color":0},"levelRoleInfo":{"roleId":"0","name":"","color":0},"recallTime":"0","isOnlineMsg":true,"generalFlags":{},"clientSeq":"0","fileGroupSize":null,"foldingInfo":null,"multiTransInfo":null,"senderUin":"1075442383","peerUin":"294056628","msgAttrs":{},"anonymousExtInfo":null,"nameType":0,"avatarFlag":0,"extInfoForUI":null,"personalMedal":null,"categoryManage":0,"msgEventInfo":null,"sourceType":1,"id":1045734276}
2024-11-17 10:29:21 [debug] 墨非(1075442383) | 转化为 OB11Message {"self_id":1075442383,"user_id":1075442383,"time":1731810562,"message_id":1045734276,"message_seq":1045734276,"real_id":1045734276,"message_type":"group","sender":{"user_id":1075442383,"nickname":"墨非","card":"","role":"owner"},"raw_message":"测试","font":14,"sub_type":"normal","message":[{"type":"text","data":{"text":"测试"}}],"message_format":"array","post_type":"message_sent","message_sent_type":"self","group_id":294056628}

Python 输出结果

11-17 10:29:21 [SUCCESS] nonebot | OneBot V11 1075442383 | [message_sent]: {'time': 1731812465, 'self_id': 1075442383, 'post_type'
: 'message_sent', 'user_id': 1075442383, 'message_id': 1119822371, 'message_seq': 1119822371, 'real_id': 1119822371, 'message_type
': 'group', 'sender': {'user_id': 1075442383, 'nickname': '墨非', 'card': '', 'role': 'owner'}, 'raw_message': '测试', 'font': 14,
 'sub_type': 'normal', 'message': [{'type': 'text', 'data': {'text': '测试'}}], 'message_format': 'array', 'message_sent_type': 'self', 'group_id': 294056628, 'target_id': 294056628}
11-17 10:29:21 [INFO] nonebot | Event will be handled by Matcher(type='message_sent', module=src.plugins.tmp_search, lineno=625)  
time 1731812465
self_id 1075442383
post_type message_sent

期望的结果?

和其他类型事件Event正常显示

NapCat 运行日志

No response

OneBot 客户端运行日志

No response

MliKiowa commented 5 hours ago

缺什么

Murphy08 commented 5 hours ago

这是普通消息的Event

time: 1730649150
self_id: 3223814453
post_type: message
sub_type: friend
user_id: 1075442383
message_type: private
message_id: 23294743
message: 你好
original_message: 你好
raw_message: 你好
font: 0
sender: user_id=1075442383 nickname='墨非' sex='unknown' age=None card=None area=None level=None role=None title=None
to_me: True
reply: None

这是message_sent

time 1731812465
self_id 1075442383
post_type message_sent

后面就没了 ωvω

MliKiowa commented 4 hours ago

使用 https://github.com/NapNeko/NapCatQQ/actions/runs/11875606156 这里面的版本覆盖napcat测测

Murphy08 commented 4 hours ago

覆盖测试后问题依旧

MliKiowa commented 4 hours ago

反向ws吗 4.1.5试试呢 我已经测试过了没问题 也许你应该排查下你的问题

Murphy08 commented 3 hours ago

更最新版问题已解决 万分感谢