Telegram Bots - Settings for your bot

Change the details about your bot and preferences related to privacy, inline mode etc by talking with BotFather

BotFather is the one bot to rule them all. It will help you create new bots and change settings for existing ones.

As the Telegram Bot API tells that BotFather is the one bot to control all the other bots. BotFather will allow you to create bots, modify them and even erase them from existence.

Whenever you start a chat, you will get a message similar to this:

Greeting from BotFather

Here, this message lists almost all commands that BotFather supports. You can see these commands arranged in different sections. You can access the commands either from this message (by tapping on the command) or by pressing the slash button near the message box at the bottom of screen.

General Commands

BotFather's main role is creation of bot and changing properties of bots as well. The first section of commands comprises of /newbot and /mybots:

/newbot - create a new bot

This command allows you to create a new bot. This command will start the process for creating a new Telegram bot, by asking you for the name of bot, user name for bot and then it will give you the token for accessing this bot.

Of course, you can cancel any time when using this command by using the /cancel command.

/mybots - edit your bots

This command will list all the bots that you have created so far using BotFather. They will appear as inline keyboard that you can use, or you can type in the full user name of bot after @.

List of bots created by You

When you click on bot's name, you will see a list of options that can be done with this bot. Here, you can retrieve the API Token (and even revoke this token), Edit the bot (Name, Description, About, Botpic and Commands), Edit bot settings (Allowing it in groups, Group privacy for the bot, Payment Methods and associate a Domain with the bot), Transfer the ownership to another Telegram user (by sharing new owner's contact or username) and even delete the bot.

Edit bot - Token, Settings, Ownership and delete

You can also enable your bot to be able to receive login requests on your website. This can be done by changing the domain for bot. From Bot Settings, choose Set Domain and enter the domain name. More details about web login using your bot can be found here.

You can also transfer the ownership of your bot to another Telegram user. Choose to transfer ownership in Bot Settings and enter the details of recepient to transfer the bot.

Transfer bot to another Telegram user

Edit Bots

Editing of bots can be done in two ways, the first one is by going into /mybots and then choosing bot and editing it. And the second way is by choosing options under Edit Bots heading. For all of these settings, you will be ased for choosing a bot in form of keyboard:

Bot Options - Keyboard

After choosing the bot, you will be allowed to change this particular setting. And you can /cancel the editing at any time.

/setname - change a bot's name

You can change any bot's name using this command. When you send this command to BotFather, you will be asked to choose the bot for which you want to change the name. After choosing the bot, you will be ased to provide a new name for the bot and it will be changed.

/setdescription - change bot description

This command will allow you to change the description of bot. After sending this command, you will be ased to choose the bot for which you want to change the description. And then you will have to provide the new description for your chosen bot.

/setabouttext - change bot about info

This command is similar to the previous command and will let you change the about info displayed for your bot.

/setuserpic - change a bot profile photo

This command will allow you to change the profile photo of your bot. After choosing bot, you will be asked to send a picture to be set as photo. The photo needs to be a minimum of 150x150 in size.

Note that if you set a profile photo of your bot, there is no way (currently) to remove the bot pic.

/setcommands - change the list of commands

This command will let you to edit commands of your bot (just like the commands BotFather have). You will be asked to provide list of commands separated by new line and followed by the command description. You will have to pass all the commands every time, as earlier commands will be overwritten. You can also send /empty to clear the commands for your bot.

For example if you want to set three commands for you bot you may pass it the text as:

refresh - Refresh the status
help - Show help message
settings - Show preferences

Commands - BotFather

And if you want to delete one command from bot, simple send all other commands to this message, and it will be set.

/deletebot - delete a bot

You can delete a bot by following this command. You will be asked to choose the bot and then you will be asked to confirm your action.

Deleting a bot - BotFather

Bot Settings

This list of commands will allow you to change the settings of bots individually. You will be presented with a keyboard to pick a bot and then these tasks will happen.

/token - generate authorization token

This command will allow you to re-generate the token for your bot. You will be asked to choose a bot and then a token will be generated for this bot.

/revoke - revoke bot access token

This command will revoke the bot access token, and you won't be able to access your bot without a token. So, if you do this, your bot will stop working and it will not work until you get a new token for usage again.

/setinline - toggle inline mode

This will allow you to toggle the inline mode of your bot. Inline mode allows your bot to be called just using @your_bot in any chat to provide inline results and then send them to the chat (be it private chat or any group chat - without adding the bot as a member).

/setinlinegeo - toggle inline location requests

This setting will allow your bot to gain access to location while being called inline by a user.

/setinlinefeedback - change inline feedback settings

This setting will allow you to enable/disable the feedback that you get when someone calls you bot inline. This basically will disable/enable the feature when user selects an inline result and you get a status report about which result was chosen.

This requires the bot to be activated for inline mode first.

/setjoingroups - can your bot be added to groups

This setting allows your bot to be able to join groups or not. If enabled, your bot can be added to groups and vice versa.

/setprivacy - toggle privacy mode in groups

When in groups, the bot by default receives messages which start with a back slash or which tag the bot. Disabilng the private mode will allow your bot to be able to listen to each group message (except those from other bots) without being called with a @ name.

Games

These settings apply for game bots only. These are simply - /mygames to list your games for editing, /newgame to create a new game, /editgame to edit a game (same as above) and /deletegame to delete a game bot.

Other Commands

Besides above commands, BotFather supports a few other commands as well. You can get the list of all global commands by either pressing the back slash button near message box or by typing back slash in the message box:

All Commands - BotFather

/cancel

This command can be used to cancel the current ongoing operation.

/help

This command will show the first message with list of all global commands that are available.

Using these commands with BotFather, you can customize your bot for any purpose. Here are some additional tips that may make your Telegram bot more likable and refined.

These articles are a part of Telegram bot series and will be using PHP as their coding language. But if you read through the code, you can easily adapt the code to be used in any language.