Run in CLI¶
This page takes you from nothing to a running bot. No prior experience with the project is needed. If a word is unclear, check the Concepts pages.
Before you begin¶
You need two things from Telegram:
- A bot token. Open a chat with @BotFather,
send
/newbot, follow the prompts, and copy the token it gives you. It looks like123456789:AAExampleTokenValue. - Your numeric user id. This is a number, not your
@username. If you do not know it, do not worry — the bot will tell you your id the first time you message it (see step 5).
Step 1: download¶
Download the release archive and extract it.
Download and open the release folder
Inside the folder you will find:
telegram-commander-linux-amd64andtelegram-commander-linux-arm64— the program, one per CPU typeconfig-examples/— ready-made config files (see Configuration)functions/— example custom functions (see Custom functions)
Step 2: pick your binary¶
Which file is for your machine?
Most servers and PCs are amd64 (also called x86_64). Small ARM boards
and some cloud VMs are arm64.
If you are unsure, run uname -m: x86_64 means amd64, aarch64 means
arm64.
Now you have a single program named telegram-commander.
Step 3: create your config¶
Copy the minimal example to a working file:
Open config.yaml and replace two placeholders:
YOUR_BOT_TOKEN— the token from BotFatherYOUR_USER_ID— your numeric id (or leave it for now and see step 5)
To learn what every setting means, read Configuration.
Step 4: validate¶
Always check the config before running. This catches typos and mistakes without starting the bot.
If it prints Valid configuration, you are good. If not, it lists exactly what
is wrong and where. See the CLI page for details.
Step 5: find your user id (if needed)¶
If you did not know your user id, set only the token in config.yaml, put any
number in allowed_users for now, then run the bot:
Start once to see your user id
Open Telegram, find your bot, and send it any message. Because you are not in
allowed users yet, the bot replies with your
user_id and username. Copy that id into allowed_users, stop the bot with
Ctrl+C, and run it again.
This behavior is part of how access control works; see Configuration → telegram.
Step 6: run¶
Open your bot in Telegram and send /start. You should see your menu. Tap a
button to run its command.
Your bot is live
The menu you described in config.yaml is now in your chat, and every tap
runs its command on this machine.
To keep the bot running after you log out of the server, set it up as a service. See Run as a service.
What next¶
- Add more buttons and categories: Menu
- Understand what actually runs: Functions
- See every command line option: CLI