Skip to content

Commit d18e6ab

Browse files
committed
Merge origin/1.x into fix/telegram-button-handling-and-logging
Resolved merge conflicts in src/messageManager.ts by keeping structured logging approach with pino-style error logging.
2 parents 0668820 + bbc5903 commit d18e6ab

1 file changed

Lines changed: 9 additions & 18 deletions

File tree

src/messageManager.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { Markup } from 'telegraf';
1818
import {
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
{

0 commit comments

Comments
 (0)