From d7c1835ed41d50d8e0fd42fd8c33fa760ce24bb5 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Thu, 23 Feb 2023 21:11:05 -0800 Subject: bot: implement /list command --- dbstore/peewee_store.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'dbstore') diff --git a/dbstore/peewee_store.py b/dbstore/peewee_store.py index ed52257..2f637bf 100644 --- a/dbstore/peewee_store.py +++ b/dbstore/peewee_store.py @@ -51,6 +51,19 @@ def get_user_access_key(telegram_user_id: str) -> str: return "" +def get_user_home_instance(telegram_user_id: str) -> dict: + with db.connection_context(): + try: + user = User.get(User.telegram_user_id == telegram_user_id) + return { + "home_instance": user.home_instance, + "home_instance_type": user.home_instance_type, + "default_visibility": user.toot_visibility, + } + except DoesNotExist: + return {} + + class Location(BaseModel): fsq_id = CharField(unique=True, primary_key=True) name = CharField(max_length=128) -- cgit v1.2.3