From adb574ab528fbc4401fb7cd50b8748d1fb529450 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Thu, 23 Feb 2023 00:30:52 -0800 Subject: bot: multi user working --- dbstore/peewee_store.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dbstore') diff --git a/dbstore/peewee_store.py b/dbstore/peewee_store.py index 3d37140..272e230 100644 --- a/dbstore/peewee_store.py +++ b/dbstore/peewee_store.py @@ -41,6 +41,15 @@ def get_user_by_state(state: str) -> dict: return {} +def get_user_access_key(telegram_user_id: str) -> str: + with db.connection_context(): + try: + user = User.get(User.telegram_user_id == telegram_user_id) + return user.access_key + except DoesNotExist: + return "" + + class Location(BaseModel): fsq_id = CharField(unique=True, primary_key=True) name = CharField(max_length=128) -- cgit v1.2.3