Refactor into plugin.

This commit is contained in:
2024-08-31 06:38:21 +10:00
parent ef8922a44c
commit d1297ae986
5 changed files with 21 additions and 0 deletions

39
voicefix/data.py Normal file
View File

@@ -0,0 +1,39 @@
from data import Registry, RowModel, Table
from data.columns import Integer, Bool, Timestamp, String
class LinkData(Registry):
class Link(RowModel):
"""
Schema
------
CREATE TABLE links(
linkid SERIAL PRIMARY KEY,
name TEXT
);
"""
_tablename_ = 'links'
_cache_ = {}
linkid = Integer(primary=True)
name = String()
channel_links = Table('channel_links')
class LinkHook(RowModel):
"""
Schema
------
CREATE TABLE channel_webhooks(
channelid BIGINT PRIMARY KEY,
webhookid BIGINT NOT NULL,
token TEXT NOT NULL
);
"""
_tablename_ = 'channel_webhooks'
_cache_ = {}
channelid = Integer(primary=True)
webhookid = Integer()
token = String()