diff options
author | clarkzjw <[email protected]> | 2023-02-23 00:30:52 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-02-23 12:07:32 -0800 |
commit | adb574ab528fbc4401fb7cd50b8748d1fb529450 (patch) | |
tree | 9cdcad48cc8963d1b2fccb8b4e32cd5a0b6877bc /dbstore | |
parent | 770cd0ec5eb556d912bd9d200b2da76c7e3bd7c8 (diff) | |
download | swarm2fediverse-adb574ab528fbc4401fb7cd50b8748d1fb529450.tar.gz |
bot: multi user working
Diffstat (limited to 'dbstore')
-rw-r--r-- | dbstore/peewee_store.py | 9 |
1 files changed, 9 insertions, 0 deletions
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: | |||
41 | return {} | 41 | return {} |
42 | 42 | ||
43 | 43 | ||
44 | def get_user_access_key(telegram_user_id: str) -> str: | ||
45 | with db.connection_context(): | ||
46 | try: | ||
47 | user = User.get(User.telegram_user_id == telegram_user_id) | ||
48 | return user.access_key | ||
49 | except DoesNotExist: | ||
50 | return "" | ||
51 | |||
52 | |||
44 | class Location(BaseModel): | 53 | class Location(BaseModel): |
45 | fsq_id = CharField(unique=True, primary_key=True) | 54 | fsq_id = CharField(unique=True, primary_key=True) |
46 | name = CharField(max_length=128) | 55 | name = CharField(max_length=128) |