Added new user vars for db and debug.

This commit is contained in:
ZKWolf 2023-06-22 22:47:03 +02:00
parent 8504efd828
commit 7d0621806f
3 changed files with 69 additions and 8 deletions

View File

@ -35,5 +35,14 @@ def debug_user(steamid):
currency_iron=user_data.get('currency_iron'),
unlocked_items=user_data.get('unlocked_items'),
userId=user_data.get('userId'),
xp=user_data.get('xp')
account_xp=user_data.get('account_xp'),
runner_xp=user_data.get('runner_xp'),
hunter_xp=user_data.get('hunter_xp'),
is_banned=user_data.get('is_banned'),
ban_reason=user_data.get('ban_reason'),
ban_start=user_data.get('ban_start'),
ban_expire=user_data.get('ban_expire'),
special_unlocks=user_data.get('special_unlocks'),
finished_challanges=user_data.get('finished_challanges'),
open_challanges=user_data.get('open_challanges')
)

View File

@ -34,13 +34,21 @@ class Mongo:
'userId': userId,
'token': token,
'eula': False,
'xp': 0,
'account_xp': 0,
'prestige_xp': 0,
'runner_xp': 0,
'hunter_xp': 0,
'currency_blood_cells': 0,
'currency_iron': 0,
'currency_ink_cells': 0,
'unlocked_items': [],
'is_banned': False,
'special_unlocks': []
'ban_reason': "NoReasonGiven",
'ban_start': 2177449139,
'ban_expire': 253392484149,
'special_unlocks': [],
'finished_challanges': [],
'open_challanges': []
}
self.dyn_collection.insert_one(new_document)
@ -111,22 +119,30 @@ class Mongo:
print(e)
return {"status": "error", "message": "Error in mongodb_handler"}
def get_data_with_list(self, login, items, server, db, collection):
def get_data_with_list(self, login, login_steam, items, server, db, collection):
try:
document = {}
login = str(login)
self.dyn_server = server
self.dyn_db = db
self.dyn_collection = collection
client = pymongo.MongoClient(self.dyn_server)
self.dyn_db = client[self.dyn_db]
self.dyn_collection = self.dyn_db[self.dyn_collection]
existing_document = self.dyn_collection.find_one({"userid": login})
if login_steam:
existing_document = self.dyn_collection.find_one({'steamid': login})
else:
existing_document = self.dyn_collection.find_one({"userId": login})
if existing_document:
for item in items:
document[item] = existing_document.get(item)
else:
print(f"No user found with userId: {login}")
if login_steam:
print(f"No user found with steamid: {login}")
else:
print(f"No user found with userId: {login}")
return None
return document
except Exception as e:
print(e)
return None

View File

@ -54,8 +54,44 @@
<td>{{ userId }}</td>
</tr>
<tr>
<td>XP</td>
<td>{{ xp }}</td>
<td>Account XP</td>
<td>{{ account_xp }}</td>
</tr>
<tr>
<td>Runner XP</td>
<td>{{ runner_xp }}</td>
</tr>
<tr>
<td>Hunter XP</td>
<td>{{ hunter_xp }}</td>
</tr>
<tr>
<td>Is Banned</td>
<td>{{ is_banned }}</td>
</tr>
<tr>
<td>Ban Reason</td>
<td>{{ ban_reason }}</td>
</tr>
<tr>
<td>Ban Start Epoch</td>
<td>{{ ban_start }}</td>
</tr>
<tr>
<td>Ban Expire Epoch</td>
<td>{{ ban_expire }}</td>
</tr>
<tr>
<td>Special Unlocks</td>
<td>{{ special_unlocks }}</td>
</tr>
<tr>
<td>Finished Callanges</td>
<td>{{ finished_challanges }}</td>
</tr>
<tr>
<td>Open Challanges</td>
<td>{{ open_challanges }}</td>
</tr>
</tbody>
</table>