This commit is contained in:
idranme 2024-08-02 10:49:30 +00:00
parent 3f5ca8ebfa
commit 406e3c7e6b

View File

@ -50,7 +50,6 @@ export function encodeCQCode(data: OB11MessageData) {
}
const CQCodeEscape = (text: string) => {
text = text.toString()
return text.replace(/\&/g, '&').replace(/\[/g, '[').replace(/\]/g, ']').replace(/,/g, ',')
}
@ -65,7 +64,8 @@ export function encodeCQCode(data: OB11MessageData) {
continue
}
try {
result += `,${name}=${CQCodeEscape(value)}`
const text = value.toString()
result += `,${name}=${CQCodeEscape(text)}`
} catch (error) {
// If it can't be converted, skip this name-value pair
}