Login  Register

Telegram Bots with Pharo

Posted by pablo1n7 on Sep 18, 2020; 8:55pm
URL: https://forum.world.st/Telegram-Bots-with-Pharo-tp5122153.html

Hi everyone, I share a tool for creating telegram Bots with Pharo. This library provides an interface for the Telegram Bot API.

To create our telegram bot in Pharo, the first thing we need to do is to create a new object that inherits from Bottlegram. This object must define at least these three methods:
  • slashStart: to be executed when the bot receives /start.
  • slashHelp: to be executed when the bot receives /help.
  • defaultText: to be executed when the bot receives an unknown command.

The tool allows creating bots using two methods:
  • Using polling: the bot check updates for an amount of time.
  • Using webhook: Use this method to create a Teapot server to receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we received an HTTPS POST request to the specified URL

Github link: https://github.com/pablo1n7/bottlegram

If you use Telegram, do you test an echo bot in https://t.me/echo_pharo_bot

Saludos, Pablo.