diff options
author | clarkzjw <[email protected]> | 2023-02-24 21:08:59 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-02-28 15:58:02 -0800 |
commit | 353b83d415061bff2881cbe324273409740be64c (patch) | |
tree | 420fa402e7eda3425fd69b24959cffb0b2cc5039 /dbstore/peewee_store.py | |
parent | 0041eb4f9893687565e444be9d50648f49aa4d91 (diff) | |
download | swarm2fediverse-353b83d415061bff2881cbe324273409740be64c.tar.gz |
bot: implement delayed checkin, (kind of), some TODO leftfeature/delayed_checkin
Diffstat (limited to 'dbstore/peewee_store.py')
-rw-r--r-- | dbstore/peewee_store.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/dbstore/peewee_store.py b/dbstore/peewee_store.py index d05c642..ebf3536 100644 --- a/dbstore/peewee_store.py +++ b/dbstore/peewee_store.py | |||
@@ -23,6 +23,15 @@ class User(BaseModel): | |||
23 | client_id = CharField(max_length=128) | 23 | client_id = CharField(max_length=128) |
24 | client_secret = CharField(max_length=128) | 24 | client_secret = CharField(max_length=128) |
25 | toot_visibility = CharField(max_length=128, default=TOOT_VISIBILITY_PRIVATE) | 25 | toot_visibility = CharField(max_length=128, default=TOOT_VISIBILITY_PRIVATE) |
26 | # delayed checkin in minutes | ||
27 | delayed_checkin = IntegerField(default=0) | ||
28 | |||
29 | |||
30 | def update_delayed_checkin(telegram_user_id: str, delayed_checkin: int) -> int: | ||
31 | with db.connection_context(): | ||
32 | return User.update(delayed_checkin=delayed_checkin).where( | ||
33 | User.telegram_user_id == telegram_user_id | ||
34 | ).execute() | ||
26 | 35 | ||
27 | 36 | ||
28 | def update_user_visibility(telegram_user_id: str, visibility: str) -> int: | 37 | def update_user_visibility(telegram_user_id: str, visibility: str) -> int: |
@@ -45,6 +54,7 @@ def get_user_by_id(telegram_user_id: str) -> dict: | |||
45 | "client_id": user.client_id, | 54 | "client_id": user.client_id, |
46 | "client_secret": user.client_secret, | 55 | "client_secret": user.client_secret, |
47 | "toot_visibility": user.toot_visibility, | 56 | "toot_visibility": user.toot_visibility, |
57 | "delayed_checkin": user.delayed_checkin, | ||
48 | } | 58 | } |
49 | except DoesNotExist: | 59 | except DoesNotExist: |
50 | return {} | 60 | return {} |