

We pass in the message_handler the command parameter equal to the array with strings – the commands to which it will respond in the manner described below. Now let’s see what it is and how it works. Let’s start with the simplest: answer the /start and /go bot.message_handler (commands = )īot.send_message (, 'Hello, when I grow up, I'll parse the headers with the Hub')

Handlers are used to respond to its commands and messages. It is even possible to make his answers useful. If there are no errors, we will continue. We open bot.py, import libraries and create the main variables. But, so that it works properly on Heroku servers, we specify version 2.2.3. Install pipenv, if it is not already available. If the bot is large, then immediately create files where you will put functions, classes, etc., otherwise, the code readability tends to zero. First start.įirst, create a file, which will be the bot ‘s main bot.py code. On this work with BotFather is over, let’s move on to the next part. Top – sparse headers from the “Web Developer Topics”

In the search, we type in a and go into a dialogue with the Father of Bots.We decided to write a banal simple bot, which will parse and give us the headlines from the SmartSpateįirst, we need to register our bot in Telegram. To begin with, it is necessary to decide what our bot will do. Answer pictures, documents, audio, and others. In this tutorial, we are going to show you how you can create your own Telegram Chat Bot from the scratch by using BotFather and Heroku. Hello everyone! We all know that this type of topic with the creation of Telegram Bot has been discussed a lot of times all over the internet.Īnd if you follow our post’s then you might know that we have created a couple of our own Telegram Bots previously and have shown you in some or other way how you can achieve this just by using proper tools.
