File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import { Markup } from 'telegraf';
1818import {
1919 type TelegramContent ,
2020 TelegramEventTypes ,
21- type TelegramMessageReceivedPayload ,
2221 type TelegramMessageSentPayload ,
2322 type TelegramReactionReceivedPayload ,
2423} from './types' ;
@@ -693,23 +692,15 @@ export class MessageManager {
693692 }
694693 } ;
695694
696- // Let the bootstrap plugin handle the message
697- this . runtime . emitEvent ( EventType . MESSAGE_RECEIVED , {
698- runtime : this . runtime ,
699- message : memory ,
700- callback,
701- source : 'telegram' ,
702- } ) ;
703-
704- // Also emit the platform-specific event
705- this . runtime . emitEvent ( TelegramEventTypes . MESSAGE_RECEIVED , {
706- runtime : this . runtime ,
707- message : memory ,
708- callback,
709- source : 'telegram' ,
710- ctx,
711- originalMessage : message ,
712- } as TelegramMessageReceivedPayload ) ;
695+ // Call the message handler directly instead of emitting events
696+ // This provides a clearer, more traceable flow for message processing
697+ if ( ! this . runtime . messageService ) {
698+ logger . error ( 'Message service is not available' ) ;
699+ throw new Error (
700+ 'Message service is not initialized. Ensure the message service is properly configured.'
701+ ) ;
702+ }
703+ await this . runtime . messageService . handleMessage ( this . runtime , memory , callback ) ;
713704 } catch ( error ) {
714705 logger . error (
715706 {
You can’t perform that action at this time.
0 commit comments