Skip to content

ilotterytea/bot

Repository files navigation

ilotterytea's rustpilled bot

A utility and entertainment multi-chat Twitch bot.

Features

  • Listening to the stream start/end and notifying chatters.
  • Sending messages in intervals (like timers)
  • PostgreSQL database support
  • Ping all chatters with a message (massping)
  • Counting emote usage

Installation guide

Clone the git repository

git clone https://git.ilotterytea.kz/tea/bot.git
cd bot

Create the configuration file

POSTGRES_USER=db_user
POSTGRES_DB=db_name
POSTGRES_PASSWORD=db_password
POSTGRES_HOSTNAME=db

BOT_USERNAME=YYYYYY
BOT_PASSWORD=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# if you want github features
GITHUB_API_TOKEN=ghp_XXXXXXXXXXXXXXXX

You must generate an OAuth2 password from TwitchTokenGenerator with special scopes for bot, because this password is used not only for chat communication, but also for commands that use Twitch API endpoints that can only be accessed with special permissions (for example, !massping requires moderator:read:chatters).

If you are going to use Docker, then POSTGRES_HOSTNAME must be equal to db (POSTGRES_HOSTNAME=db)

If you are going to run it yourself (via cargo run), POSTGRES_HOSTNAME must equal localhost or IP address if the server is not local (e.g. POSTGRES_HOSTNAME=localhost).

Startup

  1. Via Docker Compose
docker-compose up

The installation will take up about 10-11 gigabytes of space.

  1. Manually
  • Twitch bot: cargo run --release --package bot
  • API: cargo run --release --package api
  • Web: cd web && npm run build && npm start

Enabling emote usage counting (optional)

  1. Clone the git repository of ilotterytea/stats
git clone https://git.ilotterytea.kz/tea/stats.git
cd stats
  1. Follow the installation steps in the ilotterytea/stats's README file

  2. Add these fields to the bot's configuration

STATS_API_HOSTNAME=XXXXXX
STATS_API_PASSWORD=AAAAAA:BBBBBB

STATS_API_PASSWORD is optional unless you set reverse proxy authentication for the /join and /part endpoints mentioned in the stats's README file.