I have been developing a Telegram bot with Node.js, whose purpose is to capture the messages sent by other bots in the same group. Currently, I have several bots in the group, and I want my bot to detect the responses generated by other bots when commands are executed, such as when I use the /ban command.
The problem I’m facing is that my bot doesn’t seem to be able to identify other bots in the group. While my bot recognizes itself as part of the group, it cannot detect the presence of other bots, which means it also cannot capture their responses. However, my bot does listen to messages from any user that is not a bot.
I have tried to solve this using the Telegraf library and the following methods:
bot.on('message', ...) to receive messages.
ctx.message.from.is_bot to check if a user is a bot.
ctx.getChatAdministrators() to get the list of administrators in the group.
However, it only shows me human admins and not the bots that are admins.
Can anyone help me understand how I can make my bot recognize other bots in the group and listen to their messages? Any guidance or advice would be greatly appreciated. Thank you!
Jonnathan Gonzalez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.