Example #1
0
def admin(param):
    fct = param["fct"]
    arg2 = param["arg2"]
    arg3 = param["arg3"]
    arg4 = param["arg4"]
    msg = []
    if fct == "playerid":
        if arg2 == "None":
            platform = param["name_pl"]
        else:
            platform = arg2
    else:
        platform = param["name_pl"]
    if param["name_pl"] == "Admin" and fct != "playerid":
        PlayerID = int(param["ID"])
        lang = "EN"
    else:
        ID = sql.get_SuperID(int(param["ID"]), platform)
        lang = param["lang"]
        if ID == "Error 404":
            msg = [
                "WarningMsg",
                lang_P.forge_msg(lang, "WarningMsg", None, False, 0)
            ]
            return msg
        PlayerID = sql.get_PlayerID(ID, "gems")

    if fct == "init":
        sql.init()
    elif fct == "update":
        # arg2 = nameDB | arg3 = fieldName | arg4 = fieldValue
        desc = sql.updateField(PlayerID, arg3, arg4, arg2)
    elif fct == "add":
        # arg2 = nameDB | arg3 = nameElem | arg4 = nbElem
        desc = sql.add(PlayerID, arg3, arg4, arg2)
    elif fct == "value":
        # arg2 = nameDB | arg3 = nameElem
        desc = sql.valueAt(PlayerID, arg3, arg2)
    elif fct == "gems":
        # arg2 = nb gems
        desc = sql.addGems(PlayerID, arg2)
    elif fct == "spinelles":
        # arg2 = nb spinelles
        desc = sql.addSpinelles(PlayerID, arg2)
    elif fct == "balance total" or fct == 'balancetotal':
        desc = "Balance total"
        desc += "\n{}:gem:".format(sql.countTotalGems())
        spinelleidmoji = "{idmoji[spinelle]}"
        desc += "\n{0}<:spinelle:{1}>".format(sql.countTotalSpinelles(),
                                              spinelleidmoji)
    elif fct == "playerid":
        desc = "PlayerID: {}".format(PlayerID)
    else:
        desc = ":regional_indicator_s::regional_indicator_q::regional_indicator_l:"

    msg.append("Admin {}".format(fct))
    msg.append(lang)
    msg.append(str(desc))
    return msg
Example #2
0
from core import level as lvl
from core import manage_seasons as MS
import manage_commands as mc
from languages import lang

# Ouverture du port
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:5555")
check = True
msg = ""
VERSION = open("core/version.txt").read().replace("\n", "")

# Initialisation
print('\nGet Gems - Server ' + VERSION)
print(sql.init())
flag = sql.checkField()
if flag == 0:
    print("SQL >> Aucun champ n'a été ajouté, supprimé ou modifié.")
elif "add" in flag:
    print("SQL >> Un ou plusieurs champs ont été ajoutés à la DB.")
elif "sup" in flag:
    print("SQL >> Un ou plusieurs champs ont été supprimés de la DB.")
elif "type" in flag:
    print("SQL >> Un ou plusieurs type ont été modifié sur la DB.")

sql.newPlayer(GF.idGetGems, "gems", "discord", "Get Gems")
sql.newPlayer(GF.idBaBot, "gems", "discord", "BaBot")

lang.init()