From 96cc4186baa41d4821f4104905210abbdb7d9fe1 Mon Sep 17 00:00:00 2001 From: GDcheerios Date: Mon, 4 Nov 2024 22:22:08 -0600 Subject: [PATCH] added endpoint to add classic money --- crap/gentrys_quest_crap/GQManager.py | 5 +++++ main.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/crap/gentrys_quest_crap/GQManager.py b/crap/gentrys_quest_crap/GQManager.py index 6455fde..1f88ea4 100644 --- a/crap/gentrys_quest_crap/GQManager.py +++ b/crap/gentrys_quest_crap/GQManager.py @@ -153,6 +153,11 @@ def add_item(item_type: str, data, is_classic: bool, owner: int): def gift_item(item_type: str, data, is_classic: bool, owner: int): return Item.gift_item(item_type, data, is_classic, owner) + @staticmethod + def classic_add_money(id, amount): + DB.do("UPDATE gentrys_quest_classic_data SET new_money = new_money + %s where id = %s", params=(amount, id)) + return amount + @staticmethod @ranking def remove_item(id: int): diff --git a/main.py b/main.py index 68d59da..151ec1e 100644 --- a/main.py +++ b/main.py @@ -383,6 +383,12 @@ async def update_classic_data(id): return "Bad token" +@app.route("/api/gqc/add-money/++") +async def classic_add_money(id, amount, secret): + if secret == client.secret: + return GQManager.classic_add_money(id, amount) + + @app.route("/api/gqc/get-data/", methods=['GET']) async def classic_get_data(id): return GQManager.get_data(id, True)