Skip to content

Chat bot based on db.chgk.info questions database

License

Notifications You must be signed in to change notification settings

zetraison/chgk-bot

Repository files navigation

chgk-bot

Go Go Report Card Docker Telegram Bot Docker ICQ Bot

Telegram Bot based on http://db.chgk.info questions database.

Features

Chgk bot supports next commands:

  • /start - starts bot and shows help
  • /help - shows help
  • /question - sends random question to chat
  • /round - starts round of game
  • /stop - stops round of game
  • /score - shows results

Building

You need either Docker and make, or go in order to build binary.

Build with Go

GOOS=linux GOARCH=amd64 go build -o bin/chgk-telegram-bot cmd/telegram/main.go
GOOS=linux GOARCH=amd64 go build -o bin/chgk-icq-bot cmd/icq/main.go

or

make compile

Build with Docker

docker build -f build/Dockerfile.telegram -t zetraison/chgk-telegram-bot .
docker build -f build/Dockerfile.icq -t zetraison/chgk-icq-bot .

or

make docker_build

Running

You need setup ENV variables $(TELEGRAM_BOT_TOKEN) and $(ICQ_BOT_TOKEN) in .env file or in your environment to run binaries.

Run with Go

export TELEGRAM_BOT_TOKEN=$(TELEGRAM_BOT_TOKEN) go run cmd/telegram/main.go
export ICQ_BOT_TOKEN=$(ICQ_BOT_TOKEN) go run cmd/icq/main.go

or

make docker_run_telegram_bot
make docker_run_icq_bot

Run with Docker

docker run -it --rm -e TELEGRAM_BOT_TOKEN=$(TELEGRAM_BOT_TOKEN) zetraison/chgk-telegram-bot
docker run -it --rm -e ICQ_BOT_TOKEN=$(ICQ_BOT_TOKEN) zetraison/chgk-icq-bot

or

make docker_run_telegram_bot
make docker_run_icq_bot