コード例 #1
0
def get_main_bot_token():
    global _main_bot_token
    if _main_bot_token != "":
        return _main_bot_token

    _main_bot_token = json.loads(open("Files/jsons/config.json").read())["maker_token"]
    if _main_bot_token == "TOKEN":
        Log.critical("imposta la token del bot principale in Files/jsons/config.json")
        exit()

    bots = get_bots_id()
    if get_main_bot_id() not in bots:
        add_bot(get_owner_id(), get_main_bot_id(), _main_bot_token)
        Log.d("First boot needed to configure, please restart the script.")
        exit()

    return _main_bot_token
コード例 #2
0
def get_main_bot_id():
    token = get_main_bot_token()
    if ":" not in token:
        Log.critical("la token impostata non è valida.")
        exit()
    return int(token.split(":")[0])
コード例 #3
0
def get_lastfm_token():
    token = json.loads(open("Files/jsons/config.json").read())["lastfm_token"]
    if token == "TOKEN":
        Log.critical("imposta la token di lastfm in Files/jsons/config.json")
        exit()
    return token