Example bot template for Telegram.
With this type of setup all you need to do is:
- create a project from the template and
git clone
it - replace the module and bot name to your own
- run
make init
to set up the project and its dependencies - add required code
- set up the environment or your
.env
file for your needs - modify
.service
file 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:
config
for configurationbolt
for database (using BoltDB)file
for file and network helperstelegram
package with bot implementation
To add another custom command handler, you can:
- add a command to
.env
file (and also a corresponding message, if required) - edit
internal
packages