Exemplo n.º 1
0
def savePoleStats(update, type):
    username = update.message.from_user.name.replace("@", "")
    path = ''
    if type == 'pole':
        path += 'polestats.json'
    elif type == 'xero':
        path += 'polexerostats.json'
    elif type == 'nordis':
        path += 'polenordisstats.json'
    elif type == 'rae':
        path += 'poleraestats.json'
    elif type == 'yonki':
        path += 'poleyonki.json'

    data = Utils.loadFile(path, True, [
                          {'username': username, 'count': 0}])

    found = None
    i = 0
    while i < len(data):
        if data[i]['username'] == username:
            data[i]['count'] += 1
            found = True
        i += 1
    if found == None:
        data.append({'username': username, 'count': 1})

    Utils.saveFile(path, data)
Exemplo n.º 2
0
def saveDictionary():
    Utils.saveFile('dataDictionary.json', botDict)