diff --git a/aura.py b/aura.py index 6fc4019..a872c07 100644 --- a/aura.py +++ b/aura.py @@ -29,7 +29,10 @@ 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: - return User(int(self.r.get(user_id))) + try: + return User(user_id, int(self.r.get(str(user_id)))) + except: + return None def add(self, user_id) -> User: u = User(user_id, 100) diff --git a/invite_sys.py b/invite_sys.py index 6ef14be..122563c 100644 --- a/invite_sys.py +++ b/invite_sys.py @@ -3,16 +3,15 @@ from config import * from flask import Flask, redirect from os import environ -aura = Aura('aura.json') +aura = Aura() app = Flask(__name__) @app.route('/') def root(id): - aura.load() user = aura.get(str(id)) if user: user.balance+=120 - aura.save() + aura.update(user) return redirect(INVITE, code=302) app.run('127.0.0.1', INVITE_SERVER_PORT) \ No newline at end of file