mirror of
https://github.com/wolfswolke/DeathGarden_API_Rebirth.git
synced 2026-08-19 23:54:00 -05:00
Added new handler (This will be the only handler in the future)
This commit is contained in:
@@ -38,7 +38,9 @@ class Mongo:
|
||||
'currency_blood_cells': 0,
|
||||
'currency_iron': 0,
|
||||
'currency_ink_cells': 0,
|
||||
'unlocked_items': []
|
||||
'unlocked_items': [],
|
||||
'is_banned': False,
|
||||
'special_unlocks': []
|
||||
}
|
||||
|
||||
self.dyn_collection.insert_one(new_document)
|
||||
@@ -109,5 +111,25 @@ class Mongo:
|
||||
print(e)
|
||||
return {"status": "error", "message": "Error in mongodb_handler"}
|
||||
|
||||
def get_data_with_list(self, login, items, server, db, collection):
|
||||
try:
|
||||
document = {}
|
||||
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 existing_document:
|
||||
for item in items:
|
||||
document[item] = existing_document.get(item)
|
||||
else:
|
||||
print(f"No user found with userId: {login}")
|
||||
return None
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
|
||||
|
||||
mongo = Mongo()
|
||||
|
||||
Reference in New Issue
Block a user