This commit is contained in:
2024-09-05 15:54:30 +02:00
parent beb454392b
commit 3cd1741d3f
2 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -31,8 +31,11 @@ class Aura:
self.r = redis.Redis(host=redis_host[0], port=int(redis_host[1]), username=REDIS_USER, password=REDIS_PSW, decode_responses=True)
def get(self, user_id) -> User | None:
user_id = str(user_id)
try:
return User(user_id, int(self.r.get(str(user_id))), self.last_earns[user_id] if user_id in self.last_earns else 0.0)
if not user_id in self.last_earns:
self.last_earns[user_id] = 0.0
return User(user_id, int(self.r.get(user_id)), self.last_earns[user_id])
except:
return None