CTL bot is a universal Telegram bot for executing shell commands on the server. It enables you to declare a bot menu and a list of executed commands using a configuration file.
To get your Telegram bot token, you'll need to create a new bot on Telegram. Follow these steps:
- Open Telegram and search for the "BotFather" bot.
- Start a chat with the BotFather and use the
/newbot
command to create a new bot. - Follow the instructions and provide a name and username for your bot.
- Once the bot is created, the BotFather will provide you with a token. Keep this token safe; you'll need it to run the bot.
-
Clone the repo
git clone https://github.com/Kroks4502/go_ctl_bot cd go_ctl_bot
-
Install dependencies
go mod tidy
-
Now edit a file config.yml to store your bot token and configure menu.
vi config.yml
-
Now open the terminal and type the following command to spin up the bot locally:
go run .
To specify which configuration file to load, use the --config.file flag.
The file is written in YAML format, defined by the scheme described below. Brackets indicate that a parameter is optional.
A valid example file can be found here.
token: 'YOUR_TOKEN' # Telegram Bot Token
debug: false # Get more information about the requests being sent to Telegram
admins: # List users ids who can use bot
- YOUR_TG_USER_ID
menu: # Bot menu options
<menu_section>
<menu_section>
title: '...' # Message & button title
buttons: # List submenu
[ - <menu_section> ... ]
command: # Shell-command to run on the server when this menu item is selected
[ <command_section> ]
<command_section>
name: 'shell-command'
args:
[ - 'arg' ... ]
- Open Telegram and search for your bot using the username you provided during bot creation.
- Send the
/start
command to your bot. - Now your can use the menu for control the server.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.