๐Ÿค– Telegram Bot

How to Create a Bot

Creating bots on Telegram is super easy. Just chat with BotFather on Telegram.

Send the command /newbot.

1st question:

  • ๐Ÿ‡บ๐Ÿ‡ธ Alright, a new bot. How are we going to call it? Please choose a name for your bot.

    Example: RR Flow Remontti

2nd question:

  • ๐Ÿ‡บ๐Ÿ‡ธ Good. Now let’s choose a username for your bot. It must end in bot. Like this, for example: TetrisBot or tetris_bot.

    Example: rrflowremontti_bot

3rd response:

  • ๐Ÿ‡บ๐Ÿ‡ธ Done! Congratulations on your new bot. You will find it at t.me/voudeletar_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:
    8065708603:AAGf1oog_2R6pUWcKT9qkjL3KLDv00nmxyk
    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

Save your token!

4th Bot Image:

To set a profile picture for your bot, send /setuserpic to @BotFather

  • ๐Ÿ‡บ๐Ÿ‡ธ Choose a bot to change profile photo. Select your bot

  • ๐Ÿ‡บ๐Ÿ‡ธ OK. Send me the new profile photo for the bot. Send the image.

Configuration

Bot settings are in the notify.json file. Click here for more information.

Token

Now with the token you saved, edit notify.json and update the bot_token value to: 8065708603:AAGf1oog_2R6pUWcKT9qkjL3KLDv00nmxyk.

On Telegram, users, groups, and groups with topics are represented by numeric IDs. For groups, the ID always starts with a minus sign (-) before the number.

How to Find Your User ID?

Just talk to your bot, locate the contact example @rrflowremontti_bot, send the command /meuid and it will reply:

/meuid
Rudimar Remontti, your user ID is 200000000

How to Find Group ID?

Add your bot to the desired group and send the command /idgrupo. The bot will respond with:

/idgrupo
The group ID: Group Name is -1000000000000

If the group has topics, send the /idgrupo command inside the desired topic to also get the topic ID:

/idgrupo
The group ID: Group Name is -1009999999999 Topic ID: 20

Now that you have the IDs, you can update the allow_responses list with all users and groups that can talk to and send commands to the bot. For groups with topics, add the group ID plus the topic ID separated by a comma, e.g., -1009999999999,20.

Also update the default_chat with the chat or group ID where messages will be sent by default.

Example configuration for notify.json:

    "telegram": [
        {
            "allow_responses": [
                "-1000000000000",
                "-1009999999999,20",
                "200000000"
            ],
            "bot_token": "8065708603:AAGf1oog_2R6pUWcKT9qkjL3KLDv00nmxyk",
            "default_chat": "-1009999999999,20"
        }
    ]

Command List

๐Ÿš€ /start

  • Start the bot

๐Ÿ†” /meuid

  • Show your user ID. (alias /myid)
    Replies to any user outside allow_responses

๐Ÿท๏ธ /idgrupo

  • Show the group ID and topic ID if it exists. (alias /groupid)
    Replies to any user outside allow_responses

๐Ÿ“Š /meusgraficos

  • Show your custom graphs (alias /mygraphics) Replies only to users/groups listed in allow_responses
    • Lists graphs configured in data_traffic_analysis.json
      • Requests time selection for the graph.
        • Delivers the graph

๐Ÿ” /filtro

  • Start a custom query (alias /filter) Replies only to users/groups listed in allow_responses
    • Lists all data sources (sources configured in config.json)
      • Requests response type: Graph or Report.
        • Graph
          • Requests time for the graph
            • Requests manual filter input
              Filter
              • Delivers the graph
        • Report
          • Aggregation type:
            • Order by:
              • Select number of results
                • Select time period
                  • In which format do you want the file?
                    TXT / CSV / JSON
                    • Reply with the desired manual filter
                      Filter
                      • Delivers the file

โŒ /cancel

  • Cancels commands like /filtro, /filter, /meusgraficos and /mygraphics

๐Ÿ‘‹ /hello

  • Greet the bot

๐Ÿ’พ /testedisco

  • Perform disk read and write speed test. (alias /disktest)
    Replies only to users/groups listed in allow_responses