From 353b83d415061bff2881cbe324273409740be64c Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Fri, 24 Feb 2023 21:08:59 -0800 Subject: bot: implement delayed checkin, (kind of), some TODO left --- dbstore/peewee_store.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dbstore/peewee_store.py') 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): client_id = CharField(max_length=128) client_secret = CharField(max_length=128) toot_visibility = CharField(max_length=128, default=TOOT_VISIBILITY_PRIVATE) + # delayed checkin in minutes + delayed_checkin = IntegerField(default=0) + + +def update_delayed_checkin(telegram_user_id: str, delayed_checkin: int) -> int: + with db.connection_context(): + return User.update(delayed_checkin=delayed_checkin).where( + User.telegram_user_id == telegram_user_id + ).execute() 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: "client_id": user.client_id, "client_secret": user.client_secret, "toot_visibility": user.toot_visibility, + "delayed_checkin": user.delayed_checkin, } except DoesNotExist: return {} -- cgit v1.2.3