|
| 1 | +.. Copyright (c) 2016 Pietro Albini <[email protected]> |
| 2 | + Released under the MIT license |
| 3 | +
|
| 4 | +.. _bot-creation: |
| 5 | + |
| 6 | +========================= |
| 7 | +Create a new Telegram bot |
| 8 | +========================= |
| 9 | + |
| 10 | +Before you start writing any code, you should create your bot on Telegram. This |
| 11 | +reserves your bot an username, and gives you the API key you need to control |
| 12 | +your bot. This chapter explains you how to do so. |
| 13 | + |
| 14 | +.. _bot-creation-naming: |
| 15 | + |
| 16 | +Choose a good username for your bot |
| 17 | +=================================== |
| 18 | + |
| 19 | +The username of your bot is really important: users will use it to tell their |
| 20 | +friends about your bot, and it will appear on telegram.me links. Also, you're |
| 21 | +not allowed to change username without recreating your bot, and so without |
| 22 | +losing users. |
| 23 | + |
| 24 | +Bot usernames must adhere to the following rules: |
| 25 | + |
| 26 | +* The username must be long at least five characters |
| 27 | +* The username can only contain letters, digits and underscores |
| 28 | +* The username must end with ``bot`` |
| 29 | + |
| 30 | +For example, all the following usernames are valid: ``my_awesome_bot``, |
| 31 | +``SpamBot``, ``test123bot``. |
| 32 | + |
| 33 | +.. _bot-creation-botfather: |
| 34 | + |
| 35 | +Create the bot with @botfather |
| 36 | +============================== |
| 37 | + |
| 38 | +Currently, you can only create a new bot... with another bot. With your |
| 39 | +Telegram client open, contact `@botfather`_, start it and execute the |
| 40 | +``/newbot`` command. It will ask you some questions about your bot. |
| 41 | + |
| 42 | +Then it will give you an unique API key, which you can use to communicate with |
| 43 | +your bot. **Be sure to keep this key secret!** Everyone with your API key can |
| 44 | +take full control of your bot, and that's not a fun thing. |
| 45 | + |
| 46 | +.. _bot-creation-customization: |
| 47 | + |
| 48 | +Customize your bot |
| 49 | +================== |
| 50 | + |
| 51 | +Other than allowing you to create it, `@botfather`_ also permits you to |
| 52 | +customize your bot. For example, you can use it to change your bot's avatar, |
| 53 | +its name, or its description. In order to see what you can do, just use the |
| 54 | +``/help`` command on @botfather. Then execute the command for the thing you |
| 55 | +want to customize. |
| 56 | + |
| 57 | +If you want to use your bot just to manage a channel, you probably don't need |
| 58 | +to do this. |
| 59 | + |
| 60 | +.. _@botfather: https://telegram.me/botfather |
0 commit comments