mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-12 06:55:58 +08:00
🐛 修复ntchat解析消息和reply问题 (#478)
* 修复ntchat消息解析和reply获取失败
* 增加re依赖
* 修复re匹配bug
* 🚨 `pre-commit-ci`修复格式错误
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
52e66b243a
commit
d5ee87eaf0
@ -1,3 +1,4 @@
|
||||
import re
|
||||
from typing import Any, List, Literal, Optional
|
||||
|
||||
from nonebot.log import logger
|
||||
@ -85,9 +86,18 @@ async def send_char_adv(bot: Bot, ev: Event):
|
||||
user_id = raw_data['author_id']
|
||||
msg_id = raw_data['message_id']
|
||||
# ntchat
|
||||
elif not messages and 'message' in raw_data:
|
||||
elif 'data' in raw_data and 'from_wxid' in raw_data['data']:
|
||||
messages = raw_data['message']
|
||||
msg_id = str(raw_data['data']['msgid'])
|
||||
if (
|
||||
'raw_msg' in raw_data['data']
|
||||
and 'xml' in raw_data['data']['raw_msg']
|
||||
):
|
||||
match = re.search(
|
||||
r'<svrid>(\d+)</svrid>', raw_data['data']['raw_msg']
|
||||
)
|
||||
if match:
|
||||
message.append(Message('reply', match.group(1)))
|
||||
# onebot
|
||||
elif 'sender' in raw_data:
|
||||
if (
|
||||
|
Loading…
x
Reference in New Issue
Block a user