mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:48:27 +00:00
refactor: share telegram caption splitting
This commit is contained in:
15
src/telegram/caption.ts
Normal file
15
src/telegram/caption.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export const TELEGRAM_MAX_CAPTION_LENGTH = 1024;
|
||||
|
||||
export function splitTelegramCaption(text?: string): {
|
||||
caption?: string;
|
||||
followUpText?: string;
|
||||
} {
|
||||
const trimmed = text?.trim() ?? "";
|
||||
if (!trimmed) {
|
||||
return { caption: undefined, followUpText: undefined };
|
||||
}
|
||||
if (trimmed.length > TELEGRAM_MAX_CAPTION_LENGTH) {
|
||||
return { caption: undefined, followUpText: trimmed };
|
||||
}
|
||||
return { caption: trimmed, followUpText: undefined };
|
||||
}
|
||||
Reference in New Issue
Block a user