add user to db on any action

This commit is contained in:
huker667 committed 2026-05-23 17:26:56 +03:00
1 parent 958ee69ab7
commit f9207e1f99
2 files changed
+22 -2

No files matched your search

+16
View File
@@ -133,6 +133,22 @@ def set_user_config(
}
def ensure_user(
user_id,
model_name=DEFAULT_MODEL,
stream_mode=DEFAULT_STREAM,
call_mode=DEFAULT_CALL
):
with shelve.open("users") as db:
key = str(user_id)
if key not in db:
db[key] = {
"model": model_name,
"stream": stream_mode,
"call": call_mode,
}
def get_user_config(user_id):
with shelve.open("users") as db:
return db.get(