mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 16:24:30 +00:00
fix: restore telegram draft streaming partials
This commit is contained in:
@@ -24,7 +24,6 @@ import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { formatUncaughtError } from "../infra/errors.js";
|
||||
import { enqueueSystemEvent } from "../infra/system-events.js";
|
||||
import { getChildLogger } from "../logging.js";
|
||||
import { withTelegramApiErrorLogging } from "./api-logging.js";
|
||||
import { resolveAgentRoute } from "../routing/resolve-route.js";
|
||||
import { resolveThreadSessionKeys } from "../routing/session-key.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
@@ -44,6 +43,7 @@ import {
|
||||
resolveTelegramUpdateId,
|
||||
type TelegramUpdateKeyContext,
|
||||
} from "./bot-updates.js";
|
||||
import { withTelegramApiErrorLogging } from "./api-logging.js";
|
||||
import { resolveTelegramFetch } from "./fetch.js";
|
||||
import { wasSentByBot } from "./sent-message-cache.js";
|
||||
|
||||
@@ -245,7 +245,6 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
||||
: undefined) ??
|
||||
(opts.allowFrom && opts.allowFrom.length > 0 ? opts.allowFrom : undefined);
|
||||
const replyToMode = opts.replyToMode ?? telegramCfg.replyToMode ?? "first";
|
||||
const streamMode = resolveTelegramStreamMode(telegramCfg);
|
||||
const nativeEnabled = resolveNativeCommandsEnabled({
|
||||
providerId: "telegram",
|
||||
providerSetting: telegramCfg.commands?.native,
|
||||
@@ -264,6 +263,7 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
||||
const ackReactionScope = cfg.messages?.ackReactionScope ?? "group-mentions";
|
||||
const mediaMaxBytes = (opts.mediaMaxMb ?? telegramCfg.mediaMaxMb ?? 5) * 1024 * 1024;
|
||||
const logger = getChildLogger({ module: "telegram-auto-reply" });
|
||||
const streamMode = resolveTelegramStreamMode(telegramCfg);
|
||||
let botHasTopicsEnabled: boolean | undefined;
|
||||
const resolveBotTopicsEnabled = async (ctx?: TelegramContext) => {
|
||||
const fromCtx = ctx?.me as { has_topics_enabled?: boolean } | undefined;
|
||||
@@ -274,6 +274,10 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
||||
if (typeof botHasTopicsEnabled === "boolean") {
|
||||
return botHasTopicsEnabled;
|
||||
}
|
||||
if (typeof bot.api.getMe !== "function") {
|
||||
botHasTopicsEnabled = false;
|
||||
return botHasTopicsEnabled;
|
||||
}
|
||||
try {
|
||||
const me = (await withTelegramApiErrorLogging({
|
||||
operation: "getMe",
|
||||
|
||||
Reference in New Issue
Block a user