fix(onebot): accept empty text placeholders in arrays

Fixes #273.
This commit is contained in:
DrSmoothl committed 2026-07-23 12:08:17 +08:00
1 parent 120dda1d9d
commit a7b9ba14fb
2 files changed
+68

No files matched your search

+4
View File
@@ -408,6 +408,10 @@ export async function parseMessage(message: JsonValue, autoEscape: boolean, opti
const elements: MessageElement[] = [];
for (const seg of message) {
const data = segmentPayload(seg);
// Some OneBot clients insert empty text between media as a separator.
// Only the exact empty string is a no-op; malformed and whitespace text
// must still pass through strict element validation.
if (seg.type.trim().toLowerCase() === 'text' && data.text === '') continue;
const elem = await segmentToElement(seg.type, data, options);
if (elem) elements.push(elem);
}