2016-10-03 07:51:12 +00:00
|
|
|
import json
|
2016-10-03 14:05:13 +00:00
|
|
|
import filemanager
|
2016-10-03 07:51:12 +00:00
|
|
|
|
2016-10-03 14:05:13 +00:00
|
|
|
db = json.loads(filemanager.readfile("db.json"))
|
2016-10-03 07:51:12 +00:00
|
|
|
|
2016-10-03 13:49:30 +00:00
|
|
|
|
|
|
|
def findbyname(name: str):
|
2016-10-03 07:51:12 +00:00
|
|
|
for player in db:
|
2017-02-20 10:58:30 +00:00
|
|
|
if db[player]["telegram"]["username"] == name:
|
2016-10-03 07:51:12 +00:00
|
|
|
return db[player]
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
|
2016-10-03 13:49:30 +00:00
|
|
|
|
2016-10-03 07:51:12 +00:00
|
|
|
def findbykey(key, value):
|
|
|
|
for player in db:
|
|
|
|
if player[key] == value:
|
|
|
|
return db[player]
|
|
|
|
else:
|
|
|
|
return None
|
2016-11-21 07:48:35 +00:00
|
|
|
|