Example bot template for Telegram.
With this type of setup all you need to do is:
- create a project from the template and
git cloneit - replace the module and bot name to your own
- run
make initto set up the project and its dependencies - add required code
- set up the environment or your
.envfile for your needs - modify
.servicefile for systemd to manage your bot - deploy your bot to the server of choice!
This bot uses:
- telebot package to work with Telegram API
- bolt for the database
- envconfig + godotenv for the configuration
- slog for the logging
This project mostly adheres to the Project Layout structure, excluding pkg folders.
internal package holds the private libraries:
configfor configurationboltfor database (using BoltDB)filefor file and network helperstelegrampackage with bot implementation
To add another custom command handler, you can:
- add a command to
.envfile (and also a corresponding message, if required) - edit
internalpackages