feat: at segment add name
This commit is contained in:
1 parent
9495a95fec
commit
d4ee1b0f29
3 files changed
+39
-24
No files matched your search
@@ -66,16 +66,16 @@ export function encodeCQCode(data: OB11MessageData) {
|
||||
|
||||
let result = '[CQ:' + data.type;
|
||||
for (const name in data.data) {
|
||||
let value = data.data[name];
|
||||
try {
|
||||
// Check if the value can be converted to a string
|
||||
value = 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}`);
|
||||
const value = data.data[name];
|
||||
if (value === undefined) {
|
||||
continue;
|
||||
}
|
||||
result += `,${name}=${CQCodeEscape(value)}`;
|
||||
try {
|
||||
const text = value.toString();
|
||||
result += `,${name}=${CQCodeEscape(text)}`;
|
||||
} catch (error) {
|
||||
// If it can't be converted, skip this name-value pair
|
||||
}
|
||||
}
|
||||
result += ']';
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user