From dbaec0332b4abc08c98bca4b922a0bc2fc6562f0 Mon Sep 17 00:00:00 2001 From: Leander Date: Mon, 7 Aug 2023 14:55:53 +0200 Subject: [PATCH] Updated autocredits.py --- rewardsystem/autocredits.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rewardsystem/autocredits.py b/rewardsystem/autocredits.py index 10afb91..7971fab 100644 --- a/rewardsystem/autocredits.py +++ b/rewardsystem/autocredits.py @@ -1,12 +1,15 @@ async def get_all_users(client): users = client['nova-core']['users'] return users - -async def update_credits(users, settings=None): + + +async def update_credits(pymongo_client, settings=None): + users = await get_all_users(pymongo_client) + if not settings: - users.update_many({}, {"$inc": {"credits": 250}}) + users.update_many({}, {"$inc": {"credits": 2500}}) else: for key, value in settings.items(): - users.update_many({'role': key}, {"$inc": {"credits": int(value)}}) - print(f'Updated {key} to {value}') + users.update_many( + {'level': key}, {"$inc": {"credits": int(value)}})