Skip to content
Search

Telegram:Bot

lastmod 2025-02-14created 2016-06-2113 edits

API Token

You can obtain a token through @BotFather.

  • [Input] /newbot
  • BotFather: Alright, a new bot. How are we going to call it? Please choose a name for your bot.
  • [Input (Korean allowed)] DecanBot
  • BotFather: Good. Now let's choose a username for your bot. It must end in bot. Like this, for example: TetrisBot or tetris_bot.
  • [Input (English only)] DecanBot
  • BotFather: Done! Congratulations on your new bot. You will find it at telegram.me/DecanBot. 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:
    ----- TOKEN -----
    For a description of the Bot API, see this page: https://core.telegram.org/bots/api

Then just add the ID. (@DecanBot in the case above)

Join Group

To simply add the bot to a group, you need to send the /setjoingroups command to @BotFather.

Privacy mode

Note that even after the bot joins a group, it cannot fetch the group's messages through the Bot API. To get permission to access messages, set the /setprivacy command to Disable via @BotFather.

Inline bots

Turning off URL preview mode

You can set disable_web_page_preview attribute to true when using sendMessage method.

It will disable link previews for links in this message.

https://core.telegram.org/bots/api#sendmessage

Adding command autocompletion to the bot

Just send the /setcommands command to BotFather.

It asks you to enter them as follows:

OK. Send me a list of commands for your bot. Please use this format:

command1 - Description
command2 - Another description

Send /empty to keep the list empty.

Command names must be entered without the /.

For example, not:

/version - Print the your.run version
/help - Print help messsage

but as follows:

version - Print the your.run version
help - Print help messsage

Troubleshooting

When you added the bot to a group but it says it cannot access messages

The English message is Has no access to message.

Go to BotFather and

자기 봇 선택 >> Bot Settings >> Group Privacy >> Turn off

See also

Favorite site

Python Telegram Bot

References


  1. Acidpop_Software_-_Create_Telegram_BOT_01.pdf ↩

  2. Acidpop_Software_-_Create_Telegram_BOT_02.pdf ↩

  3. Acidpop_Software_-_Create_Telegram_BOT_03.pdf ↩

  4. Acidpop_Software_-_Create_Telegram_BOT_04.pdf ↩

  5. Acidpop_Software_-_Create_Telegram_BOT_05.pdf ↩

author Zer0 sitemap