diff --git a/README.md b/README.md new file mode 100644 index 0000000..32348fd --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# StudyLion plugin for StreamAlerts diff --git a/data/schema.sql b/data/schema.sql new file mode 100644 index 0000000..c7043e8 --- /dev/null +++ b/data/schema.sql @@ -0,0 +1,50 @@ +-- Stream Alerts {{{ + +-- DROP TABLE IF EXISTS stream_alerts; +-- DROP TABLE IF EXISTS streams; +-- DROP TABLE IF EXISTS alert_channels; +-- DROP TABLE IF EXISTS streamers; + +CREATE TABLE streamers( + userid BIGINT PRIMARY KEY, + login_name TEXT NOT NULL, + display_name TEXT NOT NULL +); + +CREATE TABLE alert_channels( + subscriptionid SERIAL PRIMARY KEY, + guildid BIGINT NOT NULL, + channelid BIGINT NOT NULL, + streamerid BIGINT NOT NULL REFERENCES streamers (userid) ON DELETE CASCADE, + created_by BIGINT NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + paused BOOLEAN NOT NULL DEFAULT FALSE, + end_delete BOOLEAN NOT NULL DEFAULT FALSE, + live_message TEXT, + end_message TEXT +); +CREATE INDEX alert_channels_guilds ON alert_channels (guildid); +CREATE UNIQUE INDEX alert_channels_channelid_streamerid ON alert_channels (channelid, streamerid); + +CREATE TABLE streams( + streamid SERIAL PRIMARY KEY, + streamerid BIGINT NOT NULL REFERENCES streamers (userid) ON DELETE CASCADE, + start_at TIMESTAMPTZ NOT NULL, + twitch_stream_id BIGINT, + game_name TEXT, + title TEXT, + end_at TIMESTAMPTZ +); + +CREATE TABLE stream_alerts( + alertid SERIAL PRIMARY KEY, + streamid INTEGER NOT NULL REFERENCES streams (streamid) ON DELETE CASCADE, + subscriptionid INTEGER NOT NULL REFERENCES alert_channels (subscriptionid) ON DELETE CASCADE, + sent_at TIMESTAMPTZ NOT NULL, + messageid BIGINT NOT NULL, + resolved_at TIMESTAMPTZ +); + + +-- }}} + diff --git a/example-config/secrets.conf b/example-config/secrets.conf new file mode 100644 index 0000000..c383a7a --- /dev/null +++ b/example-config/secrets.conf @@ -0,0 +1,3 @@ +[TWITCH] +app_id = +app_secret = diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..58d2520 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +twitchAPI diff --git a/__init__.py b/streamalerts/__init__.py similarity index 100% rename from __init__.py rename to streamalerts/__init__.py diff --git a/cog.py b/streamalerts/cog.py similarity index 100% rename from cog.py rename to streamalerts/cog.py diff --git a/data.py b/streamalerts/data.py similarity index 100% rename from data.py rename to streamalerts/data.py diff --git a/editor.py b/streamalerts/editor.py similarity index 100% rename from editor.py rename to streamalerts/editor.py diff --git a/settings.py b/streamalerts/settings.py similarity index 100% rename from settings.py rename to streamalerts/settings.py