(data): Adding support for premium currency.
This commit is contained in:
@@ -14,7 +14,7 @@ meta = RowTable(
|
|||||||
|
|
||||||
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)
|
||||||
)
|
)
|
||||||
@@ -120,6 +120,19 @@ def get_member_rank(guildid, userid, untracked):
|
|||||||
return curs.fetchone() or (None, None)
|
return curs.fetchone() or (None, None)
|
||||||
|
|
||||||
|
|
||||||
|
@user_config.save_query
|
||||||
|
def set_gems(userid, amount):
|
||||||
|
with user_config.conn as conn:
|
||||||
|
cursor = conn.cursor()
|
||||||
|
cursor.execute(
|
||||||
|
"UPDATE user_config SET gems = %s WHERE userid = %s RETURNING *",
|
||||||
|
(amount, userid)
|
||||||
|
)
|
||||||
|
data = cursor.fetchone()
|
||||||
|
if data:
|
||||||
|
return user_config._make_rows(data)[0]
|
||||||
|
|
||||||
|
|
||||||
global_guild_blacklist = Table('global_guild_blacklist')
|
global_guild_blacklist = Table('global_guild_blacklist')
|
||||||
global_user_blacklist = Table('global_user_blacklist')
|
global_user_blacklist = Table('global_user_blacklist')
|
||||||
ignored_members = Table('ignored_members')
|
ignored_members = Table('ignored_members')
|
||||||
|
|||||||
@@ -42,9 +42,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
|
||||||
);
|
);
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user