From c9374ff515209534fe18e50e4deca9403d94f07b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E5=BD=B1?= Date: Sat, 20 Jul 2024 00:49:34 +0800 Subject: [PATCH 1/2] fix: skip problematic name-value pairs in encodeCQCode to prevent undefined errors Added logic to skip name-value pairs in encodeCQCode when value cannot be converted to string, preventing errors caused by undefined values. This ensures the function can handle such cases gracefully and continue processing other valid data. --- src/onebot11/cqcode.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/onebot11/cqcode.ts b/src/onebot11/cqcode.ts index 121320d..6b61160 100644 --- a/src/onebot11/cqcode.ts +++ b/src/onebot11/cqcode.ts @@ -61,6 +61,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 += ']' From d0967785dea3e738988224cdbdeddfd0b34d32dd Mon Sep 17 00:00:00 2001 From: linyuchen Date: Sat, 20 Jul 2024 16:58:03 +0800 Subject: [PATCH 2/2] chore: v3.27.3 --- manifest.json | 4 ++-- src/version.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 7d0d2b1..9729084 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "manifest_version": 4, "type": "extension", - "name": "LLOneBot v3.27.2", + "name": "LLOneBot v3.27.3", "slug": "LLOneBot", "description": "使你的NTQQ支持OneBot11协议进行QQ机器人开发", - "version": "3.27.2", + "version": "3.27.3", "icon": "./icon.jpg", "authors": [ { diff --git a/src/version.ts b/src/version.ts index 794ecac..f96cff0 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const version = '3.27.2' +export const version = '3.27.3'