(guild admin): Add greeting messages.

New `SettingType` `Message` for general message settings.
New setting `greeting_message`.
New setting `greeting_channel`.
New setting `starting_funds`.
New setting `returning_message`.
Add a greeting message hook.
Add initial funds on lion creation.
Data migration v3 -> v4.
This commit is contained in:
2021-10-04 18:13:53 +03:00
parent a3b339d1cf
commit b31a34e725
13 changed files with 499 additions and 14 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