mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 18:13:56 +01:00
Updated autocredits.py
This commit is contained in:
parent
9b8ab4eced
commit
dbaec0332b
|
@ -2,11 +2,14 @@ async def get_all_users(client):
|
||||||
users = client['nova-core']['users']
|
users = client['nova-core']['users']
|
||||||
return 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:
|
if not settings:
|
||||||
users.update_many({}, {"$inc": {"credits": 250}})
|
users.update_many({}, {"$inc": {"credits": 2500}})
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for key, value in settings.items():
|
for key, value in settings.items():
|
||||||
users.update_many({'role': key}, {"$inc": {"credits": int(value)}})
|
users.update_many(
|
||||||
print(f'Updated {key} to {value}')
|
{'level': key}, {"$inc": {"credits": int(value)}})
|
||||||
|
|
Loading…
Reference in a new issue