Merge branch 'utils' into python-rewrite

This commit is contained in:
2021-10-05 10:23:08 +03:00
17 changed files with 833 additions and 16 deletions

View File

@@ -74,6 +74,7 @@ lions = RowTable(
'workout_count', 'last_workout_start',
'last_study_badgeid',
'video_warned',
'_timestamp'
),
('guildid', 'userid'),
cache=TTLCache(5000, ttl=60*5),

View File

@@ -2,7 +2,7 @@ import pytz
from meta import client
from data import tables as tb
from settings import UserSettings
from settings import UserSettings, GuildSettings
class Lion:
@@ -41,7 +41,13 @@ class Lion:
if key in cls._lions:
return cls._lions[key]
else:
tb.lions.fetch_or_create(key)
lion = tb.lions.fetch(key)
if not lion:
tb.lions.create_row(
guildid=guildid,
userid=userid,
coins=GuildSettings(guildid).starting_funds.value
)
return cls(guildid, userid)
@property