feat: new api

This commit is contained in:
手瓜一十雪
2024-07-20 17:33:26 +08:00
parent 7a581066c2
commit 80c59de545
7 changed files with 36 additions and 9 deletions

View File

@@ -67,6 +67,14 @@ export function encodeCQCode(data: OB11MessageData) {
let result = '[CQ:' + data.type;
for (const name in data.data) {
const value = data.data[name];
try {
// Check if the value can be converted to a string
value.toString();
} catch (error) {
// If it can't be converted, skip this name-value pair
// console.warn(`Skipping problematic name-value pair. Name: ${name}, Value: ${value}`);
continue;
}
result += `,${name}=${CQCodeEscape(value)}`;
}
result += ']';