build: 1.4.0-beta5

This commit is contained in:
手瓜一十雪 2024-05-23 15:16:35 +08:00
parent 3db8b9078d
commit bc7b4dcc2a
2 changed files with 7 additions and 8 deletions

View File

@ -69,13 +69,7 @@ const _handlers: {
context: MessageContext
) => SendMessageElement | undefined | Promise<SendMessageElement | undefined>
} = {
[OB11MessageDataType.text]: ({ data: { text } }) => {
//如果匹配\n \r\n失败则 将全部\r转换为\n 兼容QQ 9.7.x非NT架构
if (!text.match(/\r\n/g) && !text.match(/\n/g)) {
text = text.replace(/\r/g, '\n');
}
return SendMsgElementConstructor.text(text);
},
[OB11MessageDataType.text]: ({ data: { text } }) => SendMsgElementConstructor.text(text),
[OB11MessageDataType.at]: async ({ data: { qq: atQQ } }, context) => {
if (!context.group) return undefined;

View File

@ -120,10 +120,15 @@ export class OB11Constructor {
}
else if (element.textElement) {
message_data['type'] = 'text';
const text = element.textElement.content;
let text = element.textElement.content;
if (!text.trim()) {
continue;
}
// 兼容 9.7.x 换行符
if (text.indexOf('\n') === -1 && text.indexOf('\r\n') === -1) {
text = text.replace(/\r/g, '\n');
}
message_data['data']['text'] = text;
}
else if (element.replyElement) {