-
Notifications
You must be signed in to change notification settings - Fork 0
/
Etzos_PlushieBot.sql
13 lines (13 loc) · 1.17 KB
/
Etzos_PlushieBot.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
CREATE TABLE IF NOT EXISTS karma ( id INTEGER PRIMARY KEY, item TEXT, itemNormalized TEXT UNIQUE ON CONFLICT IGNORE, added INTEGER, subtracted INTEGER )
INSERT INTO karma VALUES (NULL, ?, ?, 0, 0)
SELECT SUM(lines) FROM speakers
CREATE TABLE IF NOT EXISTS SmileyCount ( id INTEGER PRIMARY KEY AUTOINCREMENT, speaker TEXT NOT NULL, smiley INTEGER NOT NULL, count INTEGER NOT NULL DEFAULT 0, FOREIGN KEY(smiley) REFERENCES Smilies(id), UNIQUE (speaker, smiley) ON CONFLICT IGNORE )
CREATE TABLE IF NOT EXISTS flood ( id INTEGER PRIMARY KEY AUTOINCREMENT, player TEXT NOT NULL, threatIndex INTEGER NOT NULL, time TEXT NOT NULL )
CREATE TABLE IF NOT EXISTS history ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, player TEXT, target TEXT, change INTEGER, changetime TEXT )
UPDATE SmileyCount SET count=count WHERE speaker = ? AND smiley = ?
SELECT count FROM SmileyCount WHERE speaker = ? AND smiley = ?
SELECT SUM(count) FROM SmileyCount
SELECT id FROM Smilies WHERE smiley = ?
SELECT SUM(count) FROM SmileyCount WHERE speaker = ?
CREATE TABLE IF NOT EXISTS timeout ( id INTEGER PRIMARY KEY, player TEXT UNIQUE ON CONFLICT IGNORE, dateadded TEXT )
SELECT SUM(count) FROM SmileyCount WHERE smiley = ?