


























@@ -6,6 +6,7 @@ import {
66logInboundDrop,
77matchesMentionWithExplicit,
88resolveInboundMentionDecision,
9+type BuildChannelInboundEventContextParams,
910type BuildMentionRegexesOptions,
1011type NormalizedLocation,
1112} from "openclaw/plugin-sdk/channel-inbound";
@@ -50,6 +51,9 @@ import { resolveTelegramCommandIngressAuthorization } from "./ingress.js";
50515152type StickerVisionRuntime = typeof import("./sticker-vision.runtime.js");
5253type MediaUnderstandingRuntime = typeof import("./media-understanding.runtime.js");
54+type TelegramMentionFacts = NonNullable<
55+NonNullable<BuildChannelInboundEventContextParams["access"]>["mentions"]
56+>;
53575458let stickerVisionRuntimePromise: Promise<StickerVisionRuntime> | undefined;
5559let mediaUnderstandingRuntimePromise: Promise<MediaUnderstandingRuntime> | undefined;
@@ -70,6 +74,7 @@ export type TelegramInboundBodyResult = {
7074historyKey?: string;
7175commandAuthorized: boolean;
7276effectiveWasMentioned: boolean;
77+mentionFacts: TelegramMentionFacts;
7378canDetectMention: boolean;
7479shouldBypassMention: boolean;
7580hasControlCommand: boolean;
@@ -120,6 +125,39 @@ function formatSavedMediaPlaceholder(allMedia: TelegramMediaRef[]): string | und
120125return `<media:document> (${allMedia.length} attachments)`;
121126}
122127128+function resolveTelegramMentionFacts(params: {
129+canDetectMention: boolean;
130+effectiveWasMentioned: boolean;
131+explicitlyMentionedBot: boolean;
132+computedWasMentioned: boolean;
133+implicitMentionKinds: TelegramMentionFacts["implicitMentionKinds"];
134+requireMention: boolean;
135+shouldBypassMention: boolean;
136+shouldSkip: boolean;
137+}): TelegramMentionFacts {
138+let mentionSource: TelegramMentionFacts["mentionSource"];
139+if (params.explicitlyMentionedBot) {
140+mentionSource = "explicit_bot";
141+} else if (params.computedWasMentioned) {
142+mentionSource = "mention_pattern";
143+} else if (params.implicitMentionKinds && params.implicitMentionKinds.length > 0) {
144+mentionSource = "implicit_thread";
145+} else if (params.shouldBypassMention) {
146+mentionSource = "command_bypass";
147+}
148+149+return {
150+canDetectMention: params.canDetectMention,
151+wasMentioned: params.effectiveWasMentioned,
152+explicitlyMentionedBot: params.explicitlyMentionedBot,
153+ mentionSource,
154+implicitMentionKinds: params.implicitMentionKinds,
155+effectiveWasMentioned: params.effectiveWasMentioned,
156+requireMention: params.requireMention,
157+shouldSkip: params.shouldSkip,
158+};
159+}
160+123161async function resolveStickerVisionSupport(params: {
124162cfg: OpenClawConfig;
125163agentId?: string;
@@ -442,6 +480,16 @@ export async function resolveTelegramInboundBody(params: {
442480 historyKey,
443481 commandAuthorized,
444482 effectiveWasMentioned,
483+mentionFacts: resolveTelegramMentionFacts({
484+ canDetectMention,
485+ effectiveWasMentioned,
486+explicitlyMentionedBot: explicitlyMentioned,
487+ computedWasMentioned,
488+ implicitMentionKinds,
489+requireMention: Boolean(requireMention),
490+shouldBypassMention: mentionDecision.shouldBypassMention,
491+shouldSkip: mentionDecision.shouldSkip,
492+}),
445493 canDetectMention,
446494shouldBypassMention: mentionDecision.shouldBypassMention,
447495hasControlCommand: hasControlCommandInMessage,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。