-
Notifications
You must be signed in to change notification settings - Fork 3
/
base_config.sql
93 lines (76 loc) · 3.13 KB
/
base_config.sql
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
CREATE TABLE IF NOT EXISTS data
(
id SERIAL PRIMARY KEY,
content TEXT UNIQUE,
total_chars INT,
unique_chars INT,
total_words INT,
unique_words INT,
is_spam BOOLEAN,
downvotes INT DEFAULT 0,
upvotes INT DEFAULT 0
);
CREATE TABLE IF NOT EXISTS guilds
(
id BIGINT UNIQUE NOT NULL,
warnings_threshold INT DEFAULT 3 CHECK (warnings_threshold > 0 AND warnings_threshold <= 10),
timeout_duration INT DEFAULT 15 CHECK (timeout_duration > 0 AND timeout_duration < 80000),
antispam_enabled BOOLEAN DEFAULT TRUE,
antispam_ignored BIGINT[] DEFAULT ARRAY []::BIGINT[],
blacklist_enabled BOOLEAN DEFAULT TRUE,
blacklist_ignored BIGINT[] DEFAULT ARRAY []::BIGINT[],
blacklist_common TEXT[] DEFAULT ARRAY []::TEXT[] CHECK (ARRAY_LENGTH(blacklist_common, 1) <= 50),
blacklist_wild TEXT[] DEFAULT ARRAY []::TEXT[] CHECK (ARRAY_LENGTH(blacklist_wild, 1) <= 50),
blacklist_super TEXT[] DEFAULT ARRAY []::TEXT[] CHECK (ARRAY_LENGTH(blacklist_super, 1) <= 50),
blacklist_filter_enabled BOOLEAN DEFAULT TRUE,
whitelist_enabled BOOLEAN DEFAULT FALSE,
whitelist_characters VARCHAR(1024) DEFAULT 'abcdefghijklmnopqrstuvwxyz!@#$%^&*(){}[]<>-_=+?~`:;''"/\|<>.,1234567890',
whitelist_ignored BIGINT[] DEFAULT ARRAY []::BIGINT[],
nickfilter_enabled BOOLEAN DEFAULT TRUE,
nickfilter_ignored BIGINT[] DEFAULT ARRAY []::BIGINT[],
antiraid_enabled BOOLEAN DEFAULT FALSE,
antiraid_join_interval INT DEFAULT 30,
antiraid_members_limit INT DEFAULT 5,
antiraid_punishment INT DEFAULT 1, -- decodification in utils.enums.AntiraidPunishment
antiraid_invite_pause_duration INT,
linkfilter_enabled BOOLEAN DEFAULT TRUE,
log_channel BIGINT,
automod_managers BIGINT[] DEFAULT ARRAY []::BIGINT[],
description TEXT -- used in site API
);
CREATE TABLE IF NOT EXISTS version_data
(
id INT UNIQUE,
version INT NOT NULL
);
INSERT INTO version_data (id, version)
VALUES (0, 10)
ON CONFLICT DO NOTHING;
CREATE TABLE IF NOT EXISTS rules
(
id BIGINT NOT NULL,
rule_key TEXT,
rule_text TEXT,
UNIQUE (id, rule_key)
);
CREATE TABLE IF NOT EXISTS stats
(
id INT UNIQUE NOT NULL, -- decodification in utils.enums.Stat
applied_totally INT DEFAULT 0,
applied_daily INT DEFAULT 0
);
CREATE TABLE IF NOT EXISTS resets
(
id INT UNIQUE NOT NULL, -- 0 is daily
value TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS autoslowmode
(
id BIGINT PRIMARY KEY,
guild_id BIGINT NOT NULL
);
CREATE TABLE IF NOT EXISTS invite_pauses
(
guild_id BIGINT PRIMARY KEY,
paused_till TIMESTAMP NOT NULL
);