Initial commit

The bot is currently working under 3.10, need to check out 3.9 next.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-10-22 18:00:52 -07:00
commit 7f9714263d
11 changed files with 1481 additions and 0 deletions

30
db.sql Normal file
View File

@@ -0,0 +1,30 @@
CREATE TABLE IF NOT EXISTS channel (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
guild_id integer NOT NULL,
channel_id integer NOT NULL,
/* last_message needs to be set to 1420070400.0, which is Jan 1 2015 */
last_message decimal NOT NULL DEFAULT 1420070400.0
);
CREATE UNIQUE INDEX IF NOT EXISTS unique_channel ON channel(channel_id);
CREATE TABLE IF NOT EXISTS user (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
guild_id integer NOT NULL,
member_id integer NOT NULL,
reply_chance real NOT NULL,
listen integer NOT NULL DEFAULT 1
);
CREATE UNIQUE INDEX IF NOT EXISTS guild_member ON user(guild_id, member_id);
CREATE TABLE IF NOT EXISTS chain (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
user integer NOT NULL,
value text NOT NULL,
weight integer NOT NULL DEFAULT 1,
next text NOT NULL,
FOREIGN KEY(user) REFERENCES user(id)
);
CREATE UNIQUE INDEX IF NOT EXISTS chain_value_next ON chain(user, value, next);