refactor: trim qqbot helper exports · openclaw/openclaw@b9fe26a
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -291,6 +291,3 @@ export interface Credentials {
|
291 | 291 | appId: string; |
292 | 292 | clientSecret: string; |
293 | 293 | } |
294 | | - |
295 | | -// Re-export getNextMsgSeq for consumers that import from messages.ts. |
296 | | -export { getNextMsgSeq } from "./routes.js"; |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -211,7 +211,7 @@ export function buildPartFinishPersistentPolicy(
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** Business error codes that trigger persistent part-finish retry. */ |
214 | | -export const PART_FINISH_RETRYABLE_CODES: Set<number> = new Set([40093001]); |
| 214 | +const PART_FINISH_RETRYABLE_CODES: Set<number> = new Set([40093001]); |
215 | 215 | |
216 | 216 | /** upload_prepare error code indicating daily limit exceeded. */ |
217 | 217 | export const UPLOAD_PREPARE_FALLBACK_CODE = 40093002; |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -73,7 +73,7 @@ export interface DeliverDeps {
|
73 | 73 | // ---- Exported types ---- |
74 | 74 | |
75 | 75 | /** Maximum text length for a single QQ Bot message. */ |
76 | | -export const TEXT_CHUNK_LIMIT = 5000; |
| 76 | +const TEXT_CHUNK_LIMIT = 5000; |
77 | 77 | |
78 | 78 | export interface DeliverEventContext { |
79 | 79 | type: "c2c" | "guild" | "dm" | "group"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -803,6 +803,6 @@ export function accountToCreds(account: { appId: string; clientSecret: string })
|
803 | 803 | } |
804 | 804 | |
805 | 805 | /** Check whether a target type supports rich media (C2C and Group only). */ |
806 | | -export function supportsRichMedia(targetType: string): boolean { |
| 806 | +function supportsRichMedia(targetType: string): boolean { |
807 | 807 | return targetType === "c2c" || targetType === "group"; |
808 | 808 | } |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -31,11 +31,11 @@ export interface SendQueueItem {
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** 统一的媒体标签正则 — 匹配标准化后的 6 种标签 */ |
34 | | -export const MEDIA_TAG_REGEX = |
| 34 | +const MEDIA_TAG_REGEX = |
35 | 35 | /<(qqimg|qqvoice|qqvideo|qqfile|qqmedia|img)>([^<>]+)<\/(?:qqimg|qqvoice|qqvideo|qqfile|qqmedia|img)>/gi; |
36 | 36 | |
37 | 37 | /** 创建一个新的全局标签正则实例(每次调用 reset lastIndex) */ |
38 | | -export function createMediaTagRegex(): RegExp { |
| 38 | +function createMediaTagRegex(): RegExp { |
39 | 39 | return new RegExp(MEDIA_TAG_REGEX.source, MEDIA_TAG_REGEX.flags); |
40 | 40 | } |
41 | 41 | |
@@ -70,7 +70,7 @@ export interface MediaSendContext {
|
70 | 70 | * 此方法在 gateway.ts deliver 回调、outbound.ts sendText、 |
71 | 71 | * streaming.ts sendMediaQueue 中共用。 |
72 | 72 | */ |
73 | | -export function fixPathEncoding( |
| 73 | +function fixPathEncoding( |
74 | 74 | mediaPath: string, |
75 | 75 | log?: { debug?: (msg: string) => void; error?: (msg: string) => void }, |
76 | 76 | ): string { |
@@ -133,7 +133,7 @@ export function fixPathEncoding(
|
133 | 133 | * @param position 要检测的位置(字符索引) |
134 | 134 | * @returns 如果 position 在围栏代码块内返回 true |
135 | 135 | */ |
136 | | -export function isInsideCodeBlock(text: string, position: number): boolean { |
| 136 | +function isInsideCodeBlock(text: string, position: number): boolean { |
137 | 137 | const fenceRegex = /^(`{3,})[^\n]*$/gm; |
138 | 138 | let fenceMatch: RegExpExecArray | null; |
139 | 139 | let openFence: { pos: number; ticks: number } | null = null; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -63,7 +63,7 @@ export const ChannelApiSchema = {
|
63 | 63 | * Build the full API URL from base + path + query params. |
64 | 64 | * 拼接 API 基地址 + 路径 + 查询参数。 |
65 | 65 | */ |
66 | | -export function buildUrl(path: string, query?: Record<string, string>): string { |
| 66 | +function buildUrl(path: string, query?: Record<string, string>): string { |
67 | 67 | let url = `${API_BASE}${path}`; |
68 | 68 | if (query && Object.keys(query).length > 0) { |
69 | 69 | const params = new URLSearchParams(); |
@@ -84,7 +84,7 @@ export function buildUrl(path: string, query?: Record<string, string>): string {
|
84 | 84 | * Validate API path format; returns an error string or null if valid. |
85 | 85 | * 校验 API 路径格式,返回错误描述或 null(合法)。 |
86 | 86 | */ |
87 | | -export function validatePath(path: string): string | null { |
| 87 | +function validatePath(path: string): string | null { |
88 | 88 | if (!path.startsWith("/")) { |
89 | 89 | return "path must start with /"; |
90 | 90 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。