aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-02-23 21:11:05 -0800
committerclarkzjw <[email protected]>2023-02-23 21:19:14 -0800
commitd7c1835ed41d50d8e0fd42fd8c33fa760ce24bb5 (patch)
treeeecdaec4da3dd914dd72c9bda264b038aee0343b /dbstore
parent1e448735a15b633cb7743a01ce6249a506196ab8 (diff)
downloadswarm2fediverse-d7c1835ed41d50d8e0fd42fd8c33fa760ce24bb5.tar.gz
bot: implement /list command
Diffstat (limited to 'dbstore')
-rw-r--r--dbstore/peewee_store.py13
1 files changed, 13 insertions, 0 deletions
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:
51 return "" 51 return ""
52 52
53 53
54def get_user_home_instance(telegram_user_id: str) -> dict:
55 with db.connection_context():
56 try:
57 user = User.get(User.telegram_user_id == telegram_user_id)
58 return {
59 "home_instance": user.home_instance,
60 "home_instance_type": user.home_instance_type,
61 "default_visibility": user.toot_visibility,
62 }
63 except DoesNotExist:
64 return {}
65
66
54class Location(BaseModel): 67class Location(BaseModel):
55 fsq_id = CharField(unique=True, primary_key=True) 68 fsq_id = CharField(unique=True, primary_key=True)
56 name = CharField(max_length=128) 69 name = CharField(max_length=128)
Powered by cgit v1.2.3 (git 2.41.0)