mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:08:27 +00:00
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: cfd4181a23
Co-authored-by: yinghaosang <261132136+yinghaosang@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
@@ -17,6 +17,7 @@ export function createTelegramDraftStream(params: {
|
||||
chatId: number;
|
||||
maxChars?: number;
|
||||
thread?: TelegramThreadSpec | null;
|
||||
replyToMessageId?: number;
|
||||
throttleMs?: number;
|
||||
log?: (message: string) => void;
|
||||
warn?: (message: string) => void;
|
||||
@@ -28,6 +29,10 @@ export function createTelegramDraftStream(params: {
|
||||
const throttleMs = Math.max(250, params.throttleMs ?? DEFAULT_THROTTLE_MS);
|
||||
const chatId = params.chatId;
|
||||
const threadParams = buildTelegramThreadParams(params.thread);
|
||||
const replyParams =
|
||||
params.replyToMessageId != null
|
||||
? { ...threadParams, reply_to_message_id: params.replyToMessageId }
|
||||
: threadParams;
|
||||
|
||||
let streamMessageId: number | undefined;
|
||||
let lastSentText = "";
|
||||
@@ -64,7 +69,7 @@ export function createTelegramDraftStream(params: {
|
||||
await params.api.editMessageText(chatId, streamMessageId, trimmed);
|
||||
return;
|
||||
}
|
||||
const sent = await params.api.sendMessage(chatId, trimmed, threadParams);
|
||||
const sent = await params.api.sendMessage(chatId, trimmed, replyParams);
|
||||
const sentMessageId = sent?.message_id;
|
||||
if (typeof sentMessageId !== "number" || !Number.isFinite(sentMessageId)) {
|
||||
stopped = true;
|
||||
|
||||
Reference in New Issue
Block a user