eliza icon indicating copy to clipboard operation
eliza copied to clipboard

Bot Fails to Process Telegram Messages from Other Bots Despite shouldIgnoreBotMessages: false Setting

Open MbBrainz opened this issue 11 months ago • 2 comments

Describe the bug

The bot does not read or receive Telegram bot messages, even though the setting clientConfig.telegram.shouldIgnoreBotMessages is set to false.

To Reproduce

  1. Configure the bot with the following settings:
    clientConfig: {
        telegram: {
            shouldIgnoreBotMessages: false,
        },
    }
    
     2.	Start the bot using the pnpm i && pnpm start command.
     3.	Send a message from another Telegram bot to the configured bot.
     4.	Observe that the bot does not process or respond to the message.
    
    

Expected behavior

The bot should receive and process messages from other Telegram bots when shouldIgnoreBotMessages is explicitly set to false.

Screenshots

Additional context

Logs during startup and execution indicate no specific errors regarding message handling: • Initialization appears successful with services like browser, image_description, and telegram being registered and started. • The bot successfully launches and binds to the correct Telegram username . • However, the bot does not respond to messages from other bots

These issues might suggest: 1. The Telegram client is mishandling bot-specific messages despite the configuration. 2. A bug in how the message handler processes bot-originating messages.

Logs for reference: • Setting initialization:

clientConfig: {
    telegram: {
        shouldIgnoreBotMessages: false,
    },
}

Proposed steps for debugging: 1. Verify if the Telegram client is correctly handling shouldIgnoreBotMessages. 2. Debug the message handler to confirm it processes messages from other bots. 3. Ensure the bot’s agent is correctly linked to the Telegram service. 4. Test with verbose logging enabled for better insight into incoming message handling.

MbBrainz avatar Jan 09 '25 19:01 MbBrainz

Hello @MbBrainz! Welcome to the ai16z community. Thank you for opening your first issue; we appreciate your contribution. You are now a ai16z contributor!

github-actions[bot] avatar Jan 09 '25 19:01 github-actions[bot]

I also noticed that, and as far my debug went, it not trigger the bot.on("message" Handler. so, this config will not take effect. I`m wondering if is a config from telegram bot or something else...

i found this: https://stackoverflow.com/questions/78312360/python-telegram-bot-does-not-reply-to-messages-sent-by-another-bot

That's not possible, bots can never read messages from other bots. You'll have to let the second both trigger on something else. You could for example read it from the database or implement another way of sending 'events' to the second bot.

The bots only can receive messages from other bots in channels. Not in groups nor private chats.

rferrari avatar Jan 10 '25 03:01 rferrari

@rferrari @AIFlowML unfortunately it seems like the telegram bot api doesnt allow bot to bot communication in private or group messages. This is specified in the telegram docs here.

Now I believe that many people that build on Eliza with telegram would be interested in this feature however the docs seem to be a little misleading on whether this is possible or not. I think the docs or the tg config should be updated to be more clear. LMK if you aggree and ill create a pr and rename this issue.

Examples why you would want bots to recieve bot messages in the context of eliza:

  • AI participating in tg group games
  • general ai asking specialized ai for info (think kwantxbt)
  • AI actually managing groups by setting up and managing safeguard, raidbots, etc.

MbBrainz avatar Jan 18 '25 18:01 MbBrainz