refactor: trim telegram helper exports · openclaw/openclaw@d573671
steipete
·
2026-05-02
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
2 | 2 | import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; |
3 | 3 | import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime"; |
4 | 4 | |
5 | | -export type TelegramApiLogger = (message: string) => void; |
| 5 | +type TelegramApiLogger = (message: string) => void; |
6 | 6 | |
7 | 7 | type TelegramApiLoggingParams<T> = { |
8 | 8 | operation: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -export const TELEGRAM_CALLBACK_DATA_MAX_BYTES = 64; |
| 1 | +const TELEGRAM_CALLBACK_DATA_MAX_BYTES = 64; |
2 | 2 | |
3 | 3 | const TELEGRAM_APPROVE_ALLOW_ALWAYS_PATTERN = |
4 | 4 | /^\/approve(?:@[^\s]+)?\s+[A-Za-z0-9][A-Za-z0-9._:-]*\s+allow-always$/i; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,7 @@ export type NormalizedAllowFrom = {
|
14 | 14 | invalidEntries: string[]; |
15 | 15 | }; |
16 | 16 | |
17 | | -export type AllowFromMatch = AllowlistMatch<"wildcard" | "id">; |
| 17 | +type AllowFromMatch = AllowlistMatch<"wildcard" | "id">; |
18 | 18 | |
19 | 19 | const warnedInvalidEntries = new Set<string>(); |
20 | 20 | const log = createSubsystemLogger("telegram/bot-access"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -27,24 +27,24 @@ export type TelegramLogger = {
|
27 | 27 | info: (obj: Record<string, unknown>, msg: string) => void; |
28 | 28 | }; |
29 | 29 | |
30 | | -export type ResolveTelegramGroupConfig = ( |
| 30 | +type ResolveTelegramGroupConfig = ( |
31 | 31 | chatId: string | number, |
32 | 32 | messageThreadId?: number, |
33 | 33 | ) => { |
34 | 34 | groupConfig?: TelegramGroupConfig | TelegramDirectConfig; |
35 | 35 | topicConfig?: TelegramTopicConfig; |
36 | 36 | }; |
37 | 37 | |
38 | | -export type ResolveGroupActivation = (params: { |
| 38 | +type ResolveGroupActivation = (params: { |
39 | 39 | chatId: string | number; |
40 | 40 | agentId?: string; |
41 | 41 | messageThreadId?: number; |
42 | 42 | sessionKey?: string; |
43 | 43 | }) => boolean | undefined; |
44 | 44 | |
45 | | -export type ResolveGroupRequireMention = (chatId: string | number) => boolean; |
| 45 | +type ResolveGroupRequireMention = (chatId: string | number) => boolean; |
46 | 46 | |
47 | | -export type TelegramMessageContextRuntimeOverrides = Partial< |
| 47 | +type TelegramMessageContextRuntimeOverrides = Partial< |
48 | 48 | Pick< |
49 | 49 | typeof import("./bot-message-context.runtime.js"), |
50 | 50 | | "createStatusReactionController" |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -export type TelegramMediaContextPayload = { |
| 1 | +type TelegramMediaContextPayload = { |
2 | 2 | MediaPath?: string; |
3 | 3 | MediaUrl?: string; |
4 | 4 | MediaType?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,12 +6,12 @@ import { normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/te
|
6 | 6 | import { withTelegramApiErrorLogging } from "./api-logging.js"; |
7 | 7 | import { normalizeTelegramCommandName, TELEGRAM_COMMAND_NAME_PATTERN } from "./command-config.js"; |
8 | 8 | |
9 | | -export const TELEGRAM_MAX_COMMANDS = 100; |
| 9 | +const TELEGRAM_MAX_COMMANDS = 100; |
10 | 10 | export const TELEGRAM_TOTAL_COMMAND_TEXT_BUDGET = 5700; |
11 | 11 | const TELEGRAM_COMMAND_RETRY_RATIO = 0.8; |
12 | 12 | const TELEGRAM_MIN_COMMAND_DESCRIPTION_LENGTH = 1; |
13 | 13 | |
14 | | -export type TelegramMenuCommand = { |
| 14 | +type TelegramMenuCommand = { |
15 | 15 | command: string; |
16 | 16 | description: string; |
17 | 17 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -19,7 +19,7 @@ type TelegramMediaFileRef =
|
19 | 19 | | NonNullable<Message["document"]> |
20 | 20 | | NonNullable<Message["sticker"]>; |
21 | 21 | |
22 | | -export type TelegramPrimaryMedia = { |
| 22 | +type TelegramPrimaryMedia = { |
23 | 23 | placeholder: string; |
24 | 24 | fileRef: TelegramMediaFileRef; |
25 | 25 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import type { TelegramTextEntity } from "./body-helpers.js"; |
2 | 2 | |
3 | | -export const TELEGRAM_NATIVE_QUOTE_MAX_LENGTH = 1024; |
| 3 | +const TELEGRAM_NATIVE_QUOTE_MAX_LENGTH = 1024; |
4 | 4 | |
5 | | -export type TelegramNativeQuoteCandidate = { |
| 5 | +type TelegramNativeQuoteCandidate = { |
6 | 6 | text: string; |
7 | 7 | position?: number; |
8 | 8 | entities?: unknown[]; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,7 +21,7 @@ export function markReplyApplied(progress: DeliveryProgress, replyToId?: number)
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | | -export function markDelivered(progress: DeliveryProgress): void { |
| 24 | +function markDelivered(progress: DeliveryProgress): void { |
25 | 25 | progress.hasDelivered = true; |
26 | 26 | } |
27 | 27 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ import type { ChatFullInfo, Message, UserFromGetMe } from "@grammyjs/types";
|
3 | 3 | /** App-specific stream mode for Telegram stream previews. */ |
4 | 4 | export type TelegramStreamMode = "off" | "partial" | "block"; |
5 | 5 | |
6 | | -export type TelegramGetFile = () => Promise<{ file_path?: string }>; |
| 6 | +type TelegramGetFile = () => Promise<{ file_path?: string }>; |
7 | 7 | export type TelegramChatDetails = { |
8 | 8 | id?: number | string; |
9 | 9 | available_reactions?: ChatFullInfo["available_reactions"] | null; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。