@tencent-connect/openclaw-qqbot 1.6.2-alpha.2 → 1.6.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/dist/src/channel.d.ts +8 -0
- package/dist/src/channel.js +11 -29
- package/dist/src/gateway.js +75 -94
- package/dist/src/outbound.js +17 -18
- package/dist/src/ref-index-store.d.ts +1 -1
- package/dist/src/ref-index-store.js +2 -3
- package/dist/src/update-checker.d.ts +0 -7
- package/dist/src/update-checker.js +0 -19
- package/dist/src/user-messages.d.ts +6 -14
- package/dist/src/user-messages.js +6 -18
- package/package.json +1 -1
- package/src/channel.ts +12 -33
- package/src/gateway.ts +69 -85
- package/src/outbound.ts +17 -18
- package/src/ref-index-store.ts +3 -4
- package/src/update-checker.ts +0 -23
- package/src/user-messages.ts +5 -22
package/src/update-checker.ts
CHANGED
|
@@ -38,19 +38,6 @@ let _lastInfo: UpdateInfo = {
|
|
|
38
38
|
|
|
39
39
|
let _checking = false;
|
|
40
40
|
|
|
41
|
-
/** 已通知过的版本号,避免同一版本重复推送 */
|
|
42
|
-
let _notifiedVersion: string | null = null;
|
|
43
|
-
|
|
44
|
-
type UpdateFoundCallback = (info: UpdateInfo) => void;
|
|
45
|
-
let _onUpdateFound: UpdateFoundCallback | null = null;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 注册新版本发现回调(仅在首次检测到某个新版本时触发一次)
|
|
49
|
-
*/
|
|
50
|
-
export function onUpdateFound(cb: UpdateFoundCallback): void {
|
|
51
|
-
_onUpdateFound = cb;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
41
|
export function triggerUpdateCheck(log?: {
|
|
55
42
|
info: (msg: string) => void;
|
|
56
43
|
error: (msg: string) => void;
|
|
@@ -90,11 +77,6 @@ export function triggerUpdateCheck(log?: {
|
|
|
90
77
|
_lastInfo = { current: CURRENT_VERSION, latest: compareTarget, hasUpdate, checkedAt: now };
|
|
91
78
|
if (hasUpdate) {
|
|
92
79
|
log?.info?.(`[qqbot:update-checker] new version available: ${compareTarget} (current: ${CURRENT_VERSION})`);
|
|
93
|
-
// 首次发现该版本时触发回调
|
|
94
|
-
if (_onUpdateFound && compareTarget !== _notifiedVersion) {
|
|
95
|
-
_notifiedVersion = compareTarget;
|
|
96
|
-
_onUpdateFound(_lastInfo);
|
|
97
|
-
}
|
|
98
80
|
}
|
|
99
81
|
} catch (parseErr) {
|
|
100
82
|
_lastInfo = { current: CURRENT_VERSION, latest: null, hasUpdate: false, checkedAt: now, error: String(parseErr) };
|
|
@@ -107,11 +89,6 @@ export function getUpdateInfo(): UpdateInfo {
|
|
|
107
89
|
return { ..._lastInfo };
|
|
108
90
|
}
|
|
109
91
|
|
|
110
|
-
export function formatUpdateNotice(info: UpdateInfo): string {
|
|
111
|
-
if (!info.hasUpdate || !info.latest) return "";
|
|
112
|
-
return `\u{1f195} 有新版本可用: v${info.latest}(当前 v${info.current})\n使用 /qqbot-upgrade 升级`;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
92
|
function compareVersions(a: string, b: string): number {
|
|
116
93
|
const parse = (v: string) => {
|
|
117
94
|
const clean = v.replace(/^v/, "");
|
package/src/user-messages.ts
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* 用户面向的提示文案 — 已清空
|
|
3
|
+
*
|
|
4
|
+
* 设计原则(对齐飞书插件):
|
|
5
|
+
* QQBot 插件层不生成额外的用户提示信息。
|
|
6
|
+
* 所有运行时错误仅写日志,不面向用户展示。
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
export const MSG = {
|
|
7
|
-
// 图片格式校验
|
|
8
|
-
IMAGE_FORMAT_UNSUPPORTED: (ext: string) => `抱歉,暂不支持 ${ext} 格式的图片~`,
|
|
9
|
-
|
|
10
|
-
// 频道不支持的媒体类型
|
|
11
|
-
VOICE_CHANNEL_UNSUPPORTED: "抱歉,语音消息暂不支持在频道中发送~",
|
|
12
|
-
VIDEO_CHANNEL_UNSUPPORTED: "抱歉,视频消息暂不支持在频道中发送~",
|
|
13
|
-
FILE_CHANNEL_UNSUPPORTED: "抱歉,文件消息暂不支持在频道中发送~",
|
|
14
|
-
|
|
15
|
-
// 缺少必要内容
|
|
16
|
-
VOICE_MISSING_TEXT: "抱歉,语音消息缺少内容~",
|
|
17
|
-
VIDEO_MISSING_PATH: "抱歉,视频消息缺少内容~",
|
|
18
|
-
FILE_MISSING_PATH: "抱歉,文件消息缺少内容~",
|
|
19
|
-
|
|
20
|
-
// 载荷解析校验
|
|
21
|
-
PAYLOAD_PARSE_ERROR: "抱歉,消息格式异常,无法处理~",
|
|
22
|
-
UNSUPPORTED_MEDIA_TYPE: "抱歉,暂不支持该媒体类型~",
|
|
23
|
-
UNSUPPORTED_PAYLOAD_TYPE: "抱歉,暂不支持该消息类型~",
|
|
24
|
-
} as const;
|