惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
小众软件
小众软件
D
Docker
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
V2EX
博客园 - 叶小钗
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
IT之家
IT之家
博客园 - 司徒正美
M
MIT News - Artificial intelligence
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(telegram): cache edited messages · openclaw/openclaw@...
obviyus · 2026-05-11 · via Recent Commits to openclaw:main

@@ -2201,6 +2201,55 @@ export const registerTelegramHandlers = ({

22012201

errorMessage: string;

22022202

};

220322032204+

const normalizeChannelPostMessage = (post: Message): Message => {

2205+

const chatId = post.chat.id;

2206+

const syntheticFrom = post.sender_chat

2207+

? {

2208+

id: post.sender_chat.id,

2209+

is_bot: true as const,

2210+

first_name: post.sender_chat.title || "Channel",

2211+

username: post.sender_chat.username,

2212+

}

2213+

: {

2214+

id: chatId,

2215+

is_bot: true as const,

2216+

first_name: post.chat.title || "Channel",

2217+

username: post.chat.username,

2218+

};

2219+

return {

2220+

...post,

2221+

from: post.from ?? syntheticFrom,

2222+

chat: {

2223+

...post.chat,

2224+

type: "supergroup" as const,

2225+

},

2226+

} as Message;

2227+

};

2228+2229+

const recordEditedMessageForReplyChain = async (

2230+

ctxForDedupe: TelegramUpdateKeyContext,

2231+

msg: Message,

2232+

) => {

2233+

if (shouldSkipUpdate(ctxForDedupe)) {

2234+

return;

2235+

}

2236+

const isGroup = msg.chat.type === "group" || msg.chat.type === "supergroup";

2237+

const isForum = await resolveTelegramForumFlag({

2238+

chatId: msg.chat.id,

2239+

chatType: msg.chat.type,

2240+

isGroup,

2241+

isForum: msg.chat.is_forum,

2242+

getChat,

2243+

});

2244+

const normalizedMsg = withResolvedTelegramForumFlag(msg, isForum);

2245+

const resolvedThreadId = resolveTelegramForumThreadId({

2246+

isForum,

2247+

messageThreadId: normalizedMsg.message_thread_id,

2248+

});

2249+

const dmThreadId = !isGroup ? normalizedMsg.message_thread_id : undefined;

2250+

recordMessageForReplyChain(normalizedMsg, resolvedThreadId ?? dmThreadId);

2251+

};

2252+22042253

const handleInboundMessageLike = async (event: InboundTelegramEvent) => {

22052254

try {

22062255

if (shouldSkipUpdate(event.ctxForDedupe)) {

@@ -2329,6 +2378,14 @@ export const registerTelegramHandlers = ({

23292378

});

23302379

});

233123802381+

bot.on("edited_message", async (ctx) => {

2382+

const msg = ctx.editedMessage;

2383+

if (!msg) {

2384+

return;

2385+

}

2386+

await recordEditedMessageForReplyChain(ctx, msg);

2387+

});

2388+23322389

// Handle channel posts — enables bot-to-bot communication via Telegram channels.

23332390

// Telegram bots cannot see other bot messages in groups, but CAN in channels.

23342391

// This handler normalizes channel_post updates into the standard message pipeline.

@@ -2339,27 +2396,7 @@ export const registerTelegramHandlers = ({

23392396

}

2340239723412398

const chatId = post.chat.id;

2342-

const syntheticFrom = post.sender_chat

2343-

? {

2344-

id: post.sender_chat.id,

2345-

is_bot: true as const,

2346-

first_name: post.sender_chat.title || "Channel",

2347-

username: post.sender_chat.username,

2348-

}

2349-

: {

2350-

id: chatId,

2351-

is_bot: true as const,

2352-

first_name: post.chat.title || "Channel",

2353-

username: post.chat.username,

2354-

};

2355-

const syntheticMsg: Message = {

2356-

...post,

2357-

from: post.from ?? syntheticFrom,

2358-

chat: {

2359-

...post.chat,

2360-

type: "supergroup" as const,

2361-

},

2362-

} as Message;

2399+

const syntheticMsg = normalizeChannelPostMessage(post);

2363240023642401

await handleInboundMessageLike({

23652402

ctxForDedupe: ctx,

@@ -2381,4 +2418,12 @@ export const registerTelegramHandlers = ({

23812418

errorMessage: "channel_post handler failed",

23822419

});

23832420

});

2421+2422+

bot.on("edited_channel_post", async (ctx) => {

2423+

const post = ctx.editedChannelPost;

2424+

if (!post) {

2425+

return;

2426+

}

2427+

await recordEditedMessageForReplyChain(ctx, normalizeChannelPostMessage(post));

2428+

});

23842429

};