Creating bot with BotFather
Note: if you already know how to create a bot with BotFather, you can skip this chapter. There is nothing teloxide-specific in this.
To create a Telegram bot, you need to use @BotFather.
Bot Father is a bot itself, that provides commands to manage your bots.
To create a new bot, use /newbot
and then answer questions from Bot Father.
The first question is bot name. This is what you'll later see at the top of the chat with your bot. The name can easily be changed later, so there is nothing to worry about.
The second question is the bot's username, ie the @-tag with which you'll be able to mention the bot.
The username can contain a-z, A-Z, 0-9 and _
characters and must end in a bot
(case insensitive).
This is much more important that the name, since you can't ever change the username of the bot.
Choose wisely.
The "token to access the HTTP API" is the bot token that will be used to control bot with teloxide. As Bot Father mentions, you need to keep the token in secret, since it can be user by anyone.
In case the token somehow leaked you can change it via Bot Father.
Use /mybots
command, then choose the bot, click "API token" and click "Revoke current token":
There are a lot of things that you can change about your bot (eg profile picture) via /mybots
command.
You may want to check them yourself.
Some settings that affect bot capabilities:
- Bot Settings
- Inline Mode (allows to use bot in any chat by typing
@username_of_the_bot ...
) - Allow Groups? (you can disallow addition of the bot to groups)
- Group privacy (see privacy mode)
- Payments (allows to accept payments through bot)
- Domain (allows to you to use telegram to identify users on your site)
- Inline Mode (allows to use bot in any chat by typing