@@ -73,6 +73,50 @@ function transcribeCallContext(index = 0): Record<string, unknown> {
7373}
7474
7575describe ( "resolveTelegramInboundBody" , ( ) => {
76+ it ( "delivers rich-message-only updates as a sanitized placeholder" , async ( ) => {
77+ const result = await resolveTelegramBody ( {
78+ msg : {
79+ message_id : 0 ,
80+ date : 1_700_000_000 ,
81+ chat : { id : 42 , type : "private" , first_name : "Pat" } ,
82+ from : { id : 42 , first_name : "Pat" } ,
83+ rich_message : { blocks : [ { type : "paragraph" } ] } ,
84+ } as never ,
85+ } ) ;
86+
87+ expect ( result ?. rawBody ) . toBe ( "[unsupported Telegram rich_message received]" ) ;
88+ expect ( result ?. bodyText ) . toBe ( "[unsupported Telegram rich_message received]" ) ;
89+ } ) ;
90+
91+ it ( "keeps rich-message placeholders quiet in requireMention groups" , async ( ) => {
92+ const logger = { info : vi . fn ( ) } ;
93+ const result = await resolveTelegramBody ( {
94+ cfg : {
95+ channels : { telegram : { } } ,
96+ messages : { groupChat : { mentionPatterns : [ "\\btelegram\\b" ] } } ,
97+ } as never ,
98+ msg : {
99+ message_id : 1 ,
100+ date : 1_700_000_001 ,
101+ chat : { id : - 1001234567890 , type : "supergroup" , title : "Test Group" } ,
102+ from : { id : 42 , first_name : "Pat" } ,
103+ rich_message : { blocks : [ { type : "paragraph" } ] } ,
104+ } as never ,
105+ isGroup : true ,
106+ chatId : - 1001234567890 ,
107+ senderId : "42" ,
108+ groupConfig : { requireMention : true } as never ,
109+ requireMention : true ,
110+ logger,
111+ } ) ;
112+
113+ expect ( logger . info ) . toHaveBeenCalledWith (
114+ { chatId : - 1001234567890 , reason : "no-mention" } ,
115+ "skipping group message" ,
116+ ) ;
117+ expect ( result ) . toBeNull ( ) ;
118+ } ) ;
119+
76120 it ( "renders Telegram text entities before building the agent body" , async ( ) => {
77121 const result = await resolveTelegramBody ( {
78122 msg : {
0 commit comments