From fb9d36e433cf888bf0c46949fb5cc35a84a357cc Mon Sep 17 00:00:00 2001 From: Muhammed Mukhthar CM Date: Fri, 23 Jan 2026 10:37:20 +0000 Subject: [PATCH] Telegram-user: add threading tool context --- extensions/telegram-user/src/channel.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/extensions/telegram-user/src/channel.ts b/extensions/telegram-user/src/channel.ts index 04ed1e156..0a31e3f14 100644 --- a/extensions/telegram-user/src/channel.ts +++ b/extensions/telegram-user/src/channel.ts @@ -152,6 +152,17 @@ export const telegramUserPlugin: ChannelPlugin = { accountId, }), }, + threading: { + resolveReplyToMode: ({ cfg }) => cfg.channels?.["telegram-user"]?.replyToMode ?? "first", + buildToolContext: ({ context, hasRepliedRef }) => { + const threadId = context.MessageThreadId ?? context.ReplyToId; + return { + currentChannelId: context.To?.trim() || undefined, + currentThreadTs: threadId != null ? String(threadId) : undefined, + hasRepliedRef, + }; + }, + }, actions: { listActions: ({ cfg }) => { if (!cfg.channels?.["telegram-user"]) return []; @@ -161,6 +172,7 @@ export const telegramUserPlugin: ChannelPlugin = { agentPrompt: { messageToolHints: () => [ "Telegram user polls only work in groups/channels (DM polls return MEDIA_INVALID). Use the group id for polls.", + "When ChatType is group, use currentChannelId as the target for message/poll actions.", ], }, outbound: {