Is it possible to send messages from one bot to another bot using the Telegram API in Telegram? If so, how?
- In lichku directly impossible. But you can organize "talks" bots through the channel. - mymedia
2 answers
In fact, starting from November 21, 2016, bots in Telegram can “communicate” with each other through the channel. The fact is that starting from this date, the bots were able to see messages from the channels, any, even from other bots.
The following example on the python demonstrates this interaction - mutual greetings with an interval of no more than once per second.
# Демонстрационный однопоточный бот bot = telebot.TeleBot(sys.argv[1], threaded=False) # Разрешаем получение обновлений из каналов bot.get_updates(allowed_updates=["channel_post"]) # Логин бота для вывода name = bot.get_me().username @bot.channel_post_handler() def hello(msg): bot.reply_to(msg, "Привет, я @" + name) time.sleep(1) bot.polling() Before you start performing polls, call the getUpdates method with the allowed_updates parameter, which allows receiving updates in channels. The updates themselves are not yet important to us - let the pyTelegramBotAPI library deal with them.
An example of the script, if you simultaneously run two of its instance in the console.
Using the API, this can not be done:
Why doesn't it? Get it in unwelcome loops. It is not a question of bots, regardless of mode.
https://core.telegram.org/bots/faq#why-doesn-39t-my-bot-see-messages-from-other-bots
