A simple Telegram bot built using Go and the telebot.v3 library.
- Go 1.18 or later
- Telegram Bot Token (get it from @BotFather)
-
Clone the repository:
git clone https://github.com/yourusername/telegram-bot.git cd telegram-bot
-
Install dependencies:
go mod download
-
Configure the bot:
- Edit the
.env
file and replaceyour_telegram_bot_token_here
with your actual Telegram bot token.
- Edit the
go run cmd/bot/main.go
Or build and run:
go build -o bin/tgbot cmd/bot/main.go
./bin/tgbot
.
├── cmd/
│ └── bot/
│ └── main.go # Entry point
├── config/
│ └── config.go # Configuration management
├── internal/
│ └── handlers/
│ └── handlers.go # Bot command handlers
├── .env # Environment variables
├── .gitignore
├── go.mod
├── go.sum
├── main.go # Root level main file (optional)
└── README.md
To add new commands, edit the internal/handlers/handlers.go
file and register new handlers in the RegisterHandlers
function.
MIT