2.2 KiB
Executable File
Go Telegram Multibot
A scalable, multi-bot solution for Telegram using Go, GORM, and the Anthropic API.
Design Considerations
- AI-powered
- Supports multiple bot profiles
- Uses SQLite for persistence
- Implements rate limiting and user management
- Modular architecture
- Comprehensive unit tests
Usage
-
Clone the repository or install using
go get:-
Option 1: Clone the repository
git clone https://github.com/HugeFrog24/go-telegram-bot.git -
Option 2: Install using go get
go get -u github.com/HugeFrog24/go-telegram-bot -
Navigate to the project directory:
cd go-telegram-bot
-
-
Copy the default config template and edit it:
cp config/default.json config/config-mybot.jsonReplace
config-mybot.jsonwith the name of your bot.nano config/config-mybot.jsonYou can set up as many bots as you want. Just copy the template and edit the parameters.
Important
Keep your config files secret and do not commit them to version control.
- Build the application:
go build -o telegram-bot
Systemd Unit Setup
To enable the bot to start automatically on system boot and run in the background, set up a systemd unit.
-
Copy the systemd unit template and edit it:
sudo cp examples/systemd/telegram-bot.service /etc/systemd/system/telegram-bot.serviceEdit the service file:
nano /etc/systemd/system/telegram-bot.serviceAdjust the following parameters:
WorkingDirectoryExecStartUser
-
Enable and start the service:
sudo systemctl daemon-reloadsudo systemctl enable telegram-bot.servicesudo systemctl start telegram-bot.service -
Check the status:
sudo systemctl status telegram-bot
For more details on the systemd setup, refer to the demo service file.
Logs
View logs using journalctl:
journalctl -u telegram-bot
Follow logs:
journalctl -u telegram-bot -f
View errors:
journalctl -u telegram-bot -p err