Merge branch 'feature-gems' into feature-skins
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
CONFIG_FILE = "config/bot.conf"
|
CONFIG_FILE = "config/bot.conf"
|
||||||
DATA_VERSION = 11
|
DATA_VERSION = 12
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ app_config = Table('AppConfig')
|
|||||||
|
|
||||||
user_config = RowTable(
|
user_config = RowTable(
|
||||||
'user_config',
|
'user_config',
|
||||||
('userid', 'timezone', 'topgg_vote_reminder', 'avatar_hash'),
|
('userid', 'timezone', 'topgg_vote_reminder', 'avatar_hash', 'gems'),
|
||||||
'userid',
|
'userid',
|
||||||
cache=TTLCache(5000, ttl=60*5)
|
cache=TTLCache(5000, ttl=60*5)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class Row:
|
|||||||
self._pending = None
|
self._pending = None
|
||||||
|
|
||||||
def _refresh(self):
|
def _refresh(self):
|
||||||
row = self.table.select_one_where(self.table.dict_from_id(self.rowid))
|
row = self.table.select_one_where(**self.table.dict_from_id(self.rowid))
|
||||||
if not row:
|
if not row:
|
||||||
raise ValueError("Refreshing a {} which no longer exists!".format(type(self).__name__))
|
raise ValueError("Refreshing a {} which no longer exists!".format(type(self).__name__))
|
||||||
self.data = row
|
self.data = row
|
||||||
|
|||||||
@@ -21,26 +21,27 @@ group_hints = {
|
|||||||
'Personal Settings': "*Tell me about yourself!*",
|
'Personal Settings': "*Tell me about yourself!*",
|
||||||
'Guild Admin': "*Dangerous administration commands!*",
|
'Guild Admin': "*Dangerous administration commands!*",
|
||||||
'Guild Configuration': "*Control how I behave in your server.*",
|
'Guild Configuration': "*Control how I behave in your server.*",
|
||||||
'Meta': "*Information about me!*"
|
'Meta': "*Information about me!*",
|
||||||
|
'Premium': "*Support the team and keep the project alive by using LionGems!*"
|
||||||
}
|
}
|
||||||
|
|
||||||
standard_group_order = (
|
standard_group_order = (
|
||||||
('Pomodoro', 'Productivity', 'Statistics', 'Economy', 'Personal Settings', 'Meta'),
|
('Pomodoro', 'Productivity', 'Premium', 'Statistics', 'Economy', 'Personal Settings', 'Meta'),
|
||||||
)
|
)
|
||||||
|
|
||||||
mod_group_order = (
|
mod_group_order = (
|
||||||
('Moderation', 'Meta'),
|
('Moderation', 'Meta'),
|
||||||
('Pomodoro', 'Productivity', 'Statistics', 'Economy', 'Personal Settings')
|
('Pomodoro', 'Productivity', 'Premium', 'Statistics', 'Economy', 'Personal Settings')
|
||||||
)
|
)
|
||||||
|
|
||||||
admin_group_order = (
|
admin_group_order = (
|
||||||
('Guild Admin', 'Guild Configuration', 'Moderation', 'Meta'),
|
('Guild Admin', 'Guild Configuration', 'Moderation', 'Meta'),
|
||||||
('Pomodoro', 'Productivity', 'Statistics', 'Economy', 'Personal Settings')
|
('Pomodoro', 'Productivity', 'Premium', 'Statistics', 'Economy', 'Personal Settings')
|
||||||
)
|
)
|
||||||
|
|
||||||
bot_admin_group_order = (
|
bot_admin_group_order = (
|
||||||
('Bot Admin', 'Guild Admin', 'Guild Configuration', 'Moderation', 'Meta'),
|
('Bot Admin', 'Guild Admin', 'Guild Configuration', 'Moderation', 'Meta'),
|
||||||
('Pomodoro', 'Productivity', 'Statistics', 'Economy', 'Personal Settings')
|
('Pomodoro', 'Productivity', 'Premium', 'Statistics', 'Economy', 'Personal Settings')
|
||||||
)
|
)
|
||||||
|
|
||||||
# Help embed format
|
# Help embed format
|
||||||
|
|||||||
27
data/migration/v11-v12/migration.sql
Normal file
27
data/migration/v11-v12/migration.sql
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-- Add gem support
|
||||||
|
ALTER TABLE user_config ADD COLUMN gems INTEGER DEFAULT 0;
|
||||||
|
|
||||||
|
-- LionGem audit log {{{
|
||||||
|
CREATE TYPE GemTransactionType AS ENUM (
|
||||||
|
'ADMIN',
|
||||||
|
'GIFT',
|
||||||
|
'PURCHASE',
|
||||||
|
'AUTOMATIC'
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE gem_transactions(
|
||||||
|
transactionid SERIAL PRIMARY KEY,
|
||||||
|
transaction_type GemTransactionType NOT NULL,
|
||||||
|
actorid BIGINT NOT NULL,
|
||||||
|
from_account BIGINT,
|
||||||
|
to_account BIGINT,
|
||||||
|
amount INTEGER NOT NULL,
|
||||||
|
description TEXT NOT NULL,
|
||||||
|
note TEXT,
|
||||||
|
reference TEXT,
|
||||||
|
_timestamp TIMESTAMPTZ DEFAULT now()
|
||||||
|
);
|
||||||
|
CREATE INDEX gem_transactions_from ON gem_transactions (from_account);
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
INSERT INTO VersionHistory (version, author) VALUES (12, 'v11-v12 migration');
|
||||||
@@ -4,7 +4,7 @@ CREATE TABLE VersionHistory(
|
|||||||
time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
author TEXT
|
author TEXT
|
||||||
);
|
);
|
||||||
INSERT INTO VersionHistory (version, author) VALUES (11, 'Initial Creation');
|
INSERT INTO VersionHistory (version, author) VALUES (12, 'Initial Creation');
|
||||||
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION update_timestamp_column()
|
CREATE OR REPLACE FUNCTION update_timestamp_column()
|
||||||
@@ -48,9 +48,10 @@ CREATE TABLE global_guild_blacklist(
|
|||||||
CREATE TABLE user_config(
|
CREATE TABLE user_config(
|
||||||
userid BIGINT PRIMARY KEY,
|
userid BIGINT PRIMARY KEY,
|
||||||
timezone TEXT,
|
timezone TEXT,
|
||||||
topgg_vote_reminder,
|
topgg_vote_reminder BOOLEAN,
|
||||||
avatar_hash TEXT,
|
avatar_hash TEXT,
|
||||||
API_timestamp BIGINT
|
API_timestamp BIGINT,
|
||||||
|
gems INTEGER DEFAULT 0
|
||||||
);
|
);
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
@@ -821,4 +822,27 @@ CREATE TABLE sponsor_guild_whitelist(
|
|||||||
);
|
);
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
-- LionGem audit log {{{
|
||||||
|
CREATE TYPE GemTransactionType AS ENUM (
|
||||||
|
'ADMIN',
|
||||||
|
'GIFT',
|
||||||
|
'PURCHASE',
|
||||||
|
'AUTOMATIC'
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE gem_transactions(
|
||||||
|
transactionid SERIAL PRIMARY KEY,
|
||||||
|
transaction_type GemTransactionType NOT NULL,
|
||||||
|
actorid BIGINT NOT NULL,
|
||||||
|
from_account BIGINT,
|
||||||
|
to_account BIGINT,
|
||||||
|
amount INTEGER NOT NULL,
|
||||||
|
description TEXT NOT NULL,
|
||||||
|
note TEXT,
|
||||||
|
reference TEXT,
|
||||||
|
_timestamp TIMESTAMPTZ DEFAULT now()
|
||||||
|
);
|
||||||
|
CREATE INDEX gem_transactions_from ON gem_transactions (from_account);
|
||||||
|
-- }}}
|
||||||
|
|
||||||
-- vim: set fdm=marker:
|
-- vim: set fdm=marker:
|
||||||
|
|||||||
Reference in New Issue
Block a user