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
|
=== bracket bot ===
before you begin, you will need the following:
* a discord bot token
(see e.g. https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token)
* the channel id of the channel where the polls should be posted
(see https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID)
* a list of entries for your bracket
to build the bracket bot, just run make. the bracket bot uses libcurl,
libsqlite3, and Niels Lohmann's json library. the json library is downloaded
at build time. the required packages to build on debian are the following:
* g++
* libcurl-dev (this is a virtual package, satisfiable by a few options)
* libsqlite3-dev
* make
* wget
when the bot is run, it expects the following environment variables:
* BOT_TOKEN: the bot token
* CHANNEL_ID: the channel id
* POLLS_PER_DAY: the number of polls to post each day
* POST_TIME_UTC: the number of seconds past midnight utc to post the polls
(for example, to post at midnight eastern daylight time, set this to 14400)
and it expects to find a list of entries, separated by newlines, in a file
named entries.txt in the directory where it is run.
the bot creates a sqlite3 database in database.db, with the following tables:
* misc: this contains one column and one row with the current round number
* entries: a list of every entry
* name: the name of the entry
* round: if the entry has been eliminated, a zero. if the entry has passed
the current round, then the number of the next round. if the entry has not
appeared in a poll this round, or is in an active poll, then the number of
the current round.
* in_active_poll: if the entry is in an active poll, a one, otherwise a zero
* active_polls: a list of the message ids for the active polls
* past_polls: a list of every concluded poll
* round: the round where this poll happened
* entry_1: the name of the first entry
* entry_2: the name of the second entry
* users_1: the user ids of the users who voted
for the first entry, separated by commas
* users_2: the user ids of the users who voted
for the second entry, separated by commas
|