This is a template for creating a Telegram bot using Go. It uses the telebot library.
We welcome your suggestions and advice! Please feel free to submit issues if you have any ideas on how to improve this template.
After cloning the repository:
- Replace token in
cmd/config/secret.yaml
with your bot token. - Uncomment
# secret.*
in .gitignore to hide your token. And rungit rm --cached cmd/config/secret.yaml
. - Replace module name in
go.mod
with your module name. It will break the import path in the code, so you need to replace all import paths in the code with the new module name. - Replace local prefixes in
golangci.yml
with your module name. - Set ENV variable
CONFIG_PATH=cmd/config/secret.yaml
This template includes a Dockerfile and a github workflow to build and run the bot in a container.
You have to create github secrets in your repository with following names or replace this name in .github/workflows/deploy.yml
:
TIMEWEB_FULL_HOST
- full host for your server (e.g.user@1.1.1.1
)TIMEWEB_SSH_KEY
- private SSH key for your serverTIMEWEB_HOST
- host for your server (e.g.1.1.1.1
)DOCKERHUB_USERNAME
- your dockerhub usernameDOCKERHUB_TOKEN
- your dockerhub secret token