Finally fixed the credit system!

This commit is contained in:
nsde 2023-08-19 13:38:03 +02:00
parent b81c0657b7
commit e4313b439a

View file

@ -24,8 +24,8 @@ async def update_roles():
return return
level_role_names = [f'lvl{lvl}' for lvl in range(10, 110, 10)] level_role_names = [f'lvl{lvl}' for lvl in range(10, 110, 10)]
users = await autocredits.get_all_users() users_doc = await autocredits.get_all_users()
users = users.find({}) users = users_doc.find({})
users = await users.to_list(length=None) users = await users.to_list(length=None)
@ -39,10 +39,11 @@ async def update_roles():
if user_id == discord: if user_id == discord:
for role in level_role_names: for role in level_role_names:
if role in role_names: if role in role_names:
users.update_one( users_doc.update_one(
{'auth.discord': discord}, {'auth.discord': discord},
{'$set': {'level': role}} {'$set': {'level': role}}
) )
print(f'Updated {discord} to {role}') print(f'Updated {discord} to {role}')
return users return users