【英文】创建TelegramBot

Introduction

Create a Telegram Bot

Create a Bot

  • Visit the @BotFather bot and follow the instructions to create your own bot.

Use /start to view the usage instructions.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
I can help you create and manage Telegram bots. If you're new to the Bot API, please see the manual.

You can control me by sending these commands:

/newbot - create a new bot
/mybots - edit your bots

Edit Bots
/setname - change a bot's name
/setdescription - change bot description
/setabouttext - change bot about info
/setuserpic - change bot profile photo
/setcommands - change the list of commands
/deletebot - delete a bot

Bot Settings
/token - generate authorization token
/revoke - revoke bot access token
/setinline - toggle inline mode
/setinlinegeo - toggle inline location requests
/setinlinefeedback - change inline feedback settings
/setjoingroups - can your bot be added to groups?
/setprivacy - toggle privacy mode in groups

Web Apps
/myapps - edit your web apps
/newapp - create a new web app
/listapps - get a list of your web apps
/editapp - edit a web app
/deleteapp - delete an existing web app

Games
/mygames - edit your games
/newgame - create a new game
/listgames - get a list of your games
/editgame - edit a game
/deletegame - delete an existing game

Use /newbot to create a new bot.

1
Alright, a new bot. How are we going to call it? Please choose a name for your bot.

Enter the name of the bot as prompted, which will serve as the bot’s account username.

1
Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.

Enter the external name of the bot as prompted, which will be the name used for the sharing link. The name must end with _bot.

<name>: external name of the bot
0000000000:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: API Key

1
2
3
4
5
6
7
Done! Congratulations on your new bot. You will find it at t.me/<name>_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.

Use this token to access the HTTP API:
0000000000:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Keep your token secure and store it safely, it can be used by anyone to control your bot.

For a description of the Bot API, see this page: https://core.telegram.org/bots/api

Once created, use the API Key in your code to interact with the Telegram Bot.

View Bots

Use /mybots to view all bots.

Delete Bot

Use /mybots to view all bots, select the bot you want to delete -> Delete Bot -> Yes, delete the bot -> Yes, I'm 100% sure!

Completion

References

Prince of Fingering Blog
Telegram Official Documentation