I am trying to create Telegram Bot on my raspberry pi 3
import telepot bot=telepot.Bot('*tokenhere*') bot.getMe()
After this i am getting telepot.exception.UnauthorizedError with error code 401. Is it saying token is not correct?
Did you follow all of the steps in How do I Create a Bot?
From the website:
- How do I create a bot?
There's a… bot for that. Just talk to BotFather (described below in 6.) and follow a few simple steps. Once you've created a bot and received your authorization token, head down to the Bot API manual to see what you can teach your bot to do.
You may also like to check out some code examples here »
The website goes on to describe
BotFather is the one bot to rule them all. It will help you create new bots and change settings for existing ones.
Create a new bot
/newbotcommand to create a new bot. The BotFather will ask you for a name and username, then generate an authorization token for your new bot.
The name of your bot will be displayed in contact details and elsewhere.
The Username is a short name, to be used in mentions and telegram.me links. Usernames are 5-32 characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. Your bot's username must end in ‘bot’, e.g. ‘tetris_bot’ or ‘TetrisBot’.
The token is a string along the lines of
110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsawthat will be required to authorize the bot and send requests to the Bot API.
Generate an authorization token for your bot
If your existing token is compromised or you lost it for some reason, use the
/tokencommand to generate a new one.
The remaining commands are pretty self-explanatory:
It then goes on to explain the remaining commands.