Add mapcodes
This commit is contained in:
parent
e66ed05ef7
commit
03969a18d7
2 changed files with 8 additions and 2 deletions
|
@ -47,3 +47,8 @@ def auth_check(Authorization):
|
||||||
return False, "wrongpass"
|
return False, "wrongpass"
|
||||||
|
|
||||||
return True, query
|
return True, query
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def id_to_mapcode(id_):
|
||||||
|
return hex(id_).replace("0x", "").rjust(8, "0")[0:8].upper()
|
||||||
|
|
|
@ -277,13 +277,14 @@ async def upload_map(
|
||||||
elif authcheck[0]:
|
elif authcheck[0]:
|
||||||
print(authcheck)
|
print(authcheck)
|
||||||
userData = types.User(**authcheck[1])
|
userData = types.User(**authcheck[1])
|
||||||
MapCode = "SUSYBAKA" # FIXME Add mapcodes correctly
|
ID = len(list(db.maps_collection.find({}))) + 1
|
||||||
|
MapCode = db.id_to_mapcode(ID) # FIXME Add mapcodes correctly
|
||||||
db.maps_collection.insert_one(
|
db.maps_collection.insert_one(
|
||||||
{
|
{
|
||||||
**types.Map(
|
**types.Map(
|
||||||
CreatorName=userData.Username,
|
CreatorName=userData.Username,
|
||||||
CreatorId=userData.ID,
|
CreatorId=userData.ID,
|
||||||
ID=len(list(db.maps_collection.find({}))) + 1,
|
ID=ID,
|
||||||
Name=mapName,
|
Name=mapName,
|
||||||
Description=mapDescription,
|
Description=mapDescription,
|
||||||
Version=mapVersion,
|
Version=mapVersion,
|
||||||
|
|
Loading…
Reference in a new issue