summaryrefslogtreecommitdiff
path: root/README.md
blob: 47d904446e09c01688a9063a0dd310291dabf0ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ilotterytea's redpilled bot

A feature-rich chatbot for Twitch. It is written in C++17 and uses the Twitch API/IRC custom library.

> The bot in real action can be seen at [https://twitch.tv/teabot](https://twitch.tv/teabot)

## Features
+ Listening to stream start/end
+ Mass-pinging chatters
+ Timer
+ Custom commands

## Prerequisites

+ C++ compiler *(I tested only GCC)*
+ PostgreSQL

## Installation Guide (Linux)

### 1. Clone the Git repository

```bash
git clone https://git.ilotterytea.kz/services/bot
cd bot
```

### 2. Run the SQL migrations

All SQL migrations are located in the corresponding `/migrations` folder.

You can run all `up.sql` in sequence yourself or you can use [a special program created for this purpose](https://git.ilotterytea.kz/tools/sql_migrator) and run the related command:

`sqlm run --db-name DB_NAME --db-user DB_USER --db-pass DB_PASS`

### 3. Build the project

```bash
mkdir build
cd build
cmake .. -DUSE_TLS=1
make
```

### 4. Create the configuration file

The configuration file is in `KEY=VALUE` format. \
Here's example of `.env` file with required parameters. This file should be along with compiled executable.

```env
db_name=DB_NAME
db_user=DB_USER
db_pass=DB_PASS
twitch_credentials.client_id=CLIENT_ID
twitch_credentials.token=TOKEN
```

### 5. Run the bot

```bash
./redpilledbot
```

## Dependencies

+ ixwebsocket (for Twitch connections)
+ pqxx (for databases)
+ cpr (for HTTP requests)
+ nlohmann/json (for JSON data deserialization)