Let’s start with the code, replace your token ID in the script: Sudo nano /home/pi/telepot/telegram bot.py Now we need to create a Python script which runs the Telegram bot: Let’s add some lines to this text file with the names of your colleagues: Sudo nano /home/pi/telepot/txt/coffee.txt Let’s navigate to the txt folder and create a text file: Let’s start and create a function to randomly pick a colleague who gets the coffee! □ I love to keep things organized so therefor we created the directories. We created a root directory called telepot with some sub-directories called txt and img. Now we are going to create some directories where we are going to place the required files: Sudo apt-get update & sudo apt-get upgradeĪfter the update we are going to install telepot: Start a SSH connection to your Raspberry Pi and login.įirst we are going to update your Raspberry Pi before we are going to install telepot: The requested bot does not answer yet so let’s add some functions and let him respond! This token represents your bot account. We will need this token for the Python script we are going to create. This means that you can search for your bot if you search for the user the end of process, you will be given a token, something like 1010101:ABCabcABCabcABCabc. The bot will ask you to give up a username for this bot. Note: you can change the name of the bot any time you like. The bot will ask you to give your new bot a name. Open Telegram on your phone, search for a user called BotFather. The first step is to install Telegram on your mobile phone and create your Telegram account. (optional) Start your bot automatically at Raspberry Pi boot.(optional) Add the created functions to the bot.I will add some text and image features for this bot and i will describe how you can keep your bot private. In this step-by-step guide I will describe how-to create a Telegram bot on your Raspberry Pi with Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |