async def godparent(self, ctx, nom): """**[name]** | Allows you to add a player as a godparent.""" ID = ctx.author.id param = dict() param["ID"] = ID param["GPID"] = ge.nom_ID(nom) ge.socket.send_string( gg.std_send_command("godparent", ID, ge.name_pl, param)) desc = GF.msg_recv() lang = desc[1] if ID == ge.nom_ID(nom): await ctx.channel.send(lang_P.forge_msg(lang, "godparent")) else: await ctx.channel.send(desc[2])
async def bal(self, ctx, nom=None): """**{name}** | Are you rich or poor?""" ID = ctx.author.id param = dict() if nom is None: nom = ctx.author.name param["ID"] = ID else: IDname = ge.nom_ID(nom) param["ID"] = IDname nom = ctx.guild.get_member(IDname) nom = nom.name ge.socket.send_string(gg.std_send_command("bal", ID, ge.name_pl, param)) desc = GF.msg_recv() if desc[0] == "OK": lang = desc[1] title = lang_P.forge_msg(lang, "bal", [nom], False) msg = discord.Embed(title=title, color=13752280, description="", timestamp=dt.datetime.now()) msg.add_field(name="**_Balance_**", value=desc[2], inline=False) msg.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url) await ctx.channel.send(embed=msg) # Message de réussite dans la console print("Gems >> Balance de {} affichée".format(nom)) return else: await ctx.channel.send(desc[2])
async def give(self, ctx, nom, item, nb=None): """**[name] [item] [number]** | Give items to your friends!""" ID = ctx.author.id param = dict() param["ID"] = ID # param["IDGuild"] = ctx.guild.id param["nom"] = ctx.author.name param["ID_recu"] = ge.nom_ID(nom) param["Nom_recu"] = ctx.guild.get_member(param["ID_recu"]).name param["item"] = item param["nb"] = nb ge.socket.send_string( gg.std_send_command("give", ID, ge.name_pl, param)) desc = GF.msg_recv() lang = desc[1] if desc[0] == "OK": msg = discord.Embed(title=lang_P.forge_msg(lang, "stats", None, False, 3), color=13752280, description=desc[2]) msg.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url) await ctx.channel.send(embed=msg) else: await ctx.channel.send(desc[2])
async def admin(self, ctx, fct=None, ID=None, arg2=None, arg3=None, arg4=None): if ID == None: ID = ctx.author.id else: try: ID = int(ID) except: ID = ge.nom_ID(ID) param = dict() param["ID"] = ID param["fct"] = fct param["arg2"] = arg2 param["arg3"] = arg3 param["arg4"] = arg4 if ge.permission(ctx, ge.admin): ge.socket.send_string( gg.std_send_command("admin", ID, ge.name_pl, param)) msg = GF.msg_recv() await ctx.channel.send(msg[2]) else: await ctx.channel.send( "[Admin Command] Tu n'est pas autorisé à utiliser cette commande!" )
async def filleul(self, ctx, nom=None): """ Affiche la liste des filleuls d'un joueur """ if ctx.guild.id == wel.idBASTION: if nom == None: ID = ctx.author.id nom = ctx.author.name else: ID = ge.nom_ID(nom) if ID == -1: msg = "Ce joueur n'existe pas !" await ctx.channel.send(msg) return PlayerID = requests.get( 'http://{ip}/users/playerid/{discord_id}'.format( ip=ge.API_IP, discord_id=ID)).json()['ID'] F_li = requests.get( 'http://{ip}/users/godchilds/count/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID)).text countF = requests.get( 'http://{ip}/users/godchilds/count/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID)).text if F_li != 0: if int(countF) > 1: sV = "s" else: sV = "" msg = "Filleul{1} `x{0}`:".format(countF, sV) for one in F_li: msg += "\n<@{}>".format(one['discord_id']) emb = discord.Embed(title="Informations :", color=13752280, description=msg) # await bot.delete_message(ctx.message) await ctx.channel.send(embed=emb) else: msg = "Vous n'avez pas de filleul, invitez de nouveaux joueurs !" await ctx.channel.send(msg) else: await ctx.channel.send( "commande utilisable uniquement sur le discord `Bastion`")
async def filleul_supp(self, ctx, nom): """ Affiche la liste des filleuls d'un joueur """ if ctx.guild.id == wel.idBASTION: ID_p = ctx.author.id ID_f = ge.nom_ID(nom) if ID_f == -1: msg = "Ce joueur n'existe pas !" await ctx.channel.send(msg) return PlayerID_p = requests.get( 'http://{ip}/users/playerid/{discord_id}'.format( ip=ge.API_IP, discord_id=ID)).json()['ID'] PlayerID_f = requests.get( 'http://{ip}/users/playerid/{discord_id}'.format( ip=ge.API_IP, discord_id=ID_f)).json()['ID'] user_f = requests.get('http://{ip}/users/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID_f)).json() parrain = user_f['godparent'] if parrain == 0: return await ctx.channel.send("Ce joueur n'a pas de parrain") if parrain == PlayerID_p: lvl.addxp(PlayerID_f, -15) fil_count = requests.get( 'http://{ip}/users/godchilds/count/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID_p)).text gain_p = -100 * int(fil_count) lvl.addxp(PlayerID_p, gain_p) requests.put( 'http://{ip}/users/{player_id}/godparent/{godparentID}'. format(ip=ge.API_IP, player_id=PlayerID_f, godparentID=0), headers=headers) msg = "Votre filleul <@{filleul}> a bien été retiré ! Vous perdez {xp_p} XP et lui 15 XP.".format( filleul=ID_f, xp_p=-gain_p) else: msg = "Vous n'etes pas son parrain !" await ctx.channel.send(msg) else: await ctx.channel.send( "commande utilisable uniquement sur le discord `Bastion`")
async def oldinfo(self, ctx, Nom=None): """ Permet d'avoir les anciennes informations d'un utilisateur """ if Nom == None: ID = ctx.author.id Nom = ctx.author.name else: ID = ge.nom_ID(Nom) if ID != -1: if not level.checkInfo(ID): member = ctx.guild.get_member(int(ID)) await ge.addrole(member, "Nouveau") PlayerID = requests.get( 'http://{ip}/users/playerid/{discord_id}'.format( ip=ge.API_IP, discord_id=ID)).json()['ID'] user = requests.get('http://{ip}/users/old/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID)).json() lvl = int(user['level']) xp = int(user['xp']) msg = "**Utilisateur:** {}".format(Nom) emb = discord.Embed(title="Informations", color=13752280, description=msg) if ctx.guild.id == wel.idBASTION: # Niveaux part msg = "" msg += "XP: `{0}`\n".format(xp) emb.add_field(name="**_Niveau_ : {0}**".format(lvl), value=msg, inline=False) # await bot.delete_message(ctx.message) await ctx.channel.send(embed=emb) else: await ctx.channel.send( "Commande utilisable uniquement sur le discord Bastion!") else: msg = "Le nom que vous m'avez donné n'existe pas !" await ctx.channel.send(msg)
async def parrain(self, ctx, nom=None): """ Permet d'ajouter un joueur comme parrain. En le faisant vous touchez un bonus et lui aussi """ if ctx.guild.id == wel.idBASTION: ID = ctx.author.id if nom != None: ID_p = ge.nom_ID(nom) PlayerID = requests.get( 'http://{ip}/users/playerid/{discord_id}'.format( ip=ge.API_IP, discord_id=ID)).json()['ID'] user = requests.get('http://{ip}/users/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID)).json() PlayerID_p = requests.get( 'http://{ip}/users/playerid/{discord_id}'.format( ip=ge.API_IP, discord_id=ID_p)).json()['ID'] if PlayerID_p != 0 and user['godparent'] == 0 and ID_p != ID: requests.put( 'http://{ip}/users/{player_id}/godparent/{godparentID}' .format(ip=ge.API_IP, player_id=PlayerID, godparentID=PlayerID_p), headers=headers) # print("Parrain ajouté") lvl.addxp(PlayerID, 15) fil_L = requests.get( 'http://{ip}/users/godchilds/count/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID)).text gain_p = 100 * int(fil_L) lvl.addxp(PlayerID_p, gain_p) msg = "Votre parrain a bien été ajouté ! Vous empochez 15 XP et lui {0} XP.".format( gain_p) else: msg = "Impossible d'ajouter ce joueur comme parrain" await ctx.channel.send(msg) else: await ctx.channel.send( "commande utilisable uniquement sur le discord `Bastion`")
async def stats(self, ctx, Nom = None): """Player stats display.""" ID = ctx.author.id param = dict() param["ID"] = ID if ge.permission(ctx, ge.Inquisiteur): param["nom"] = Nom if Nom == None: Nom = ctx.author.name else: Nom = ctx.guild.get_member(ge.nom_ID(Nom)).name else: param["nom"] = "None" Nom = ctx.author.name ge.socket.send_string(gg.std_send_command("stats", ID, ge.name_pl, param)) tab = GF.msg_recv() lang = tab[1] if tab[0] == "NOK": await ctx.channel.send(lang_P.forge_msg(lang, "WarningMsg", None, False, 0)) return False elif tab[0] == "WarningMsg": await ctx.channel.send(tab[1]) return False ltab = len(tab) StatList = [] for i in range(2, ltab): tab[i] = tab[i].replace("(", "") tab[i] = tab[i].replace(")", "") tab[i] = tab[i].replace("'", "") tab[i] = tab[i].split(", ") StatList.append((tab[i][0], tab[i][1], tab[i][2])) StatList = sorted(StatList, key=itemgetter(2)) StatList = sorted(StatList, key=itemgetter(1)) desc = "" # Statistique non pris en charge descGeneral = "" # bal, baltop, inv, market, divers descBuy = "" # buy descSell = "" # sell descDon = "" # pay, give descForge = "" # forge descBank = "" # bank, stealing, crime, gamble descMine = "" # mine descDig = "" # dig descFish = "" # fish descSlots = "" # slots descBoxes = "" # boxes descHothouse = "" # hothouse descCooking = "" # cooking descFerment = "" # ferment for x in StatList: y = x[2].split(" | ") if x[1] == "bal" or x[1] == "inv" or x[1] == "market" or x[1] == "baltop": if x[2] == x[1]: descGeneral += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) elif x[1] == "buy": if x[2] == x[1]: descBuy += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "item": descBuy += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 1)) elif y[i] == "dépense": descBuy += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 16)) else: descBuy += y[i] + " " if i == len(y)-1: descBuy += ": `{0}`\n\n".format(x[0]) elif x[1] == "sell": if x[2] == x[1]: descSell += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "item": descSell += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 2)) elif y[i] == "gain": descSell += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 17)) else: descSell += y[i] + " " if i == len(y)-1: descSell += ": `{0}`\n\n".format(x[0]) elif x[1] == "pay" or x[1] == "give": if x[2] == x[1]: descDon += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(0, len(y)): if x[1] == "give" and y[i] == "item": descDon += "{0} {1} ".format(lang_P.forge_msg(lang, "stats", None, False, 3), y[i+1]) elif y[i] == "nb items" or y[i] == "nb gems": descDon += "{0} {1} ".format(lang_P.forge_msg(lang, "stats", None, False, 3), lang_P.forge_msg(lang, "stats", None, False, 21)) if y[i] == "nb items": descDon += "items " else: descDon += "gems " elif y[i] != "pay" and y[i] != "give": descDon += y[i] + " " if i == len(y)-1: descDon += ": `{0}`\n\n".format(x[0]) elif x[1] == "forge": if x[2] == x[1]: descForge += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "item": descForge += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 4)) elif y[i] == "nb items": descForge += "{0} {1} items ".format(lang_P.forge_msg(lang, "stats", None, False, 4), lang_P.forge_msg(lang, "stats", None, False, 21)) else: descForge += y[i] + " " if i == len(y)-1: descForge += ": `{0}`\n\n".format(x[0]) elif x[1] == "bank" or x[1] == "stealing" or x[1] == "crime" or x[1] == "gamble": if x[2] == x[1] or x[2] == "bank saving": descBank += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(0, len(y)): if x[1] == "bank" and y[i] == "gain": descBank += "{0} {1} ".format(lang_P.forge_msg(lang, "stats", None, False, 17), lang_P.forge_msg(lang, "stats", None, False, 22)) elif x[1] == "stealing" and y[i] == "gain": descBank += "{0} {1} ".format(lang_P.forge_msg(lang, "stats", None, False, 17), lang_P.forge_msg(lang, "stats", None, False, 24)) elif x[1] == "gamble": if y[i] == "win": descBank += "Gamble {0} ".format(lang_P.forge_msg(lang, "stats", None, False, 23)) elif y[i] == "max": descBank += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 29)) elif y[i] == "gain" or y[i] == "perte": if y[i] == "gain": descBank += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 17)) elif y[i] == "perte": descBank += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 18)) descBank += "_gamble_ " elif x[1] == "crime" and y[i] == "gain": descBank += "{0} _crime_ ".format(lang_P.forge_msg(lang, "stats", None, False, 17)) elif x[1] != "bank" and x[1] != "crime" and x[1] != "stealing": descBank += y[i] + " " if i == len(y)-1: descBank += ": `{0}`\n\n".format(x[0]) elif x[1] == "mine": if x[2] == x[1]: descMine += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "item": descMine += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 6)) elif y[i] == "broken": descMine += "{0} ".format(lang_P.forge_msg(lang, "stats", [y[i+1]], False, 19)) elif y[1] != "broken": descMine += y[i] + " " if i == len(y)-1: descMine += ": `{0}`\n\n".format(x[0]) elif x[1] == "fish": if x[2] == x[1]: descFish += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "item": descFish += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 7)) elif y[i] == "broken": descFish += "{0} ".format(lang_P.forge_msg(lang, "stats", [y[i+1]], False, 19)) elif y[1] != "broken": descFish += y[i] + " " if i == len(y)-1: descFish += ": `{0}`\n\n".format(x[0]) elif x[1] == "dig": if x[2] == x[1]: descDig += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "item": descDig += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 8)) elif y[i] == "broken": descDig += "{0} ".format(lang_P.forge_msg(lang, "stats", [y[i+1]], False, 19)) elif y[1] != "broken": descDig += y[i] + " " if i == len(y)-1: descDig += ": `{0}`\n\n".format(x[0]) elif x[1] == "slots": if x[2] == x[1]: descSlots += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "gain": descSlots += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 17)) elif y[i] == "perte": descSlots += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 18)) elif y[i] == "win": descSlots += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 30)) elif y[i] == "lose": descSlots += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 31)) else: descSlots += y[i] + " " if i == len(y)-1: descSlots += ": `{0}`\n\n".format(x[0]) elif x[1] == "boxes": if x[2] == x[1]: descBoxes += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "gain" and y[0] == "boxes": descBoxes += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 17)) elif y[i] == "gain" and y[0] == "lootbox": descBoxes += "Lootbox {0}".format(y[1]) elif y[i] == "open": descBoxes += "{0} ".format(lang_P.forge_msg(lang, "stats", None, False, 20)) elif y[0] != "lootbox": descBoxes += y[i] + " " if i == len(y)-1: descBoxes += ": `{0}`\n\n".format(x[0]) elif x[1] == "hothouse": if x[2] == x[1]: descHothouse += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "harvest": descHothouse += "{1} {0} ".format(lang_P.forge_msg(lang, "stats", None, False, 25), y[3]) elif y[i] == "plant": descHothouse += "{1} {0} ".format(lang_P.forge_msg(lang, "stats", None, False, 26), y[3]) if i == len(y)-1: descHothouse += ": `{0}`\n\n".format(x[0]) elif x[1] == "cooking": if x[2] == x[1]: descCooking += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "harvest": descCooking += "{1} {0} ".format(lang_P.forge_msg(lang, "stats", None, False, 25), y[3]) elif y[i] == "plant": descCooking += "{1} {0} ".format(lang_P.forge_msg(lang, "stats", None, False, 27), y[3]) if i == len(y)-1: descCooking += ": `{0}`\n\n".format(x[0]) elif x[1] == "ferment": if x[2] == x[1]: descFerment += "{2} **{1}** `{0}`\n\n".format(x[0], x[2], lang_P.forge_msg(lang, "stats", None, False, 15)) else: for i in range(1, len(y)): if y[i] == "harvest": descFerment += "{1} {0} ".format(lang_P.forge_msg(lang, "stats", None, False, 25), y[3]) elif y[i] == "plant": descFerment += "{1} {0} ".format(lang_P.forge_msg(lang, "stats", None, False, 28), y[3]) if i == len(y)-1: descFerment += ": `{0}`\n\n".format(x[0]) else: desc += "\n{1} `{0}`".format(x[0], x[2]) msg = discord.Embed(title = "Statistiques de {0} | Gems Base".format(Nom), color= 13752280, description = "", timestamp=dt.datetime.now()) msg.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url) # if descGeneral != "": # msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 0), value=descGeneral) if descBuy != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 1), value=descBuy) if descSell != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 2), value=descSell) if descDon != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 3), value=descDon) if descForge != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 4), value=descForge) if desc != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 14), value=desc) await ctx.channel.send(embed = msg) msg = discord.Embed(title = "Statistiques de {0} | Gems Play".format(Nom), color= 13752280, description = "", timestamp=dt.datetime.now()) msg.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url) if descBank != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 5), value=descBank) if descMine != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 6), value=descMine) if descFish != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 7), value=descFish) if descDig != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 8), value=descDig) if descSlots != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 9), value=descSlots) if descBoxes != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 10), value=descBoxes) if descHothouse != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 11), value=descHothouse) if descCooking != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 12), value=descCooking) if descFerment != "": msg.add_field(name=lang_P.forge_msg(lang, "stats", None, False, 13), value=descFerment) await ctx.channel.send(embed = msg)
async def bank(self, ctx, ARG=None, ARG2=None): """**[bal/add/saving] [name/number]** | Savings account""" # ======================================================================= # Initialistation des variables générales de la fonction # ======================================================================= ID = ctx.author.id param = dict() param["ID"] = ID param["ARG"] = ARG param["ARG2"] = ARG2 ge.socket.send_string( gg.std_send_command("bank", ID, ge.name_pl, param)) desc = GF.msg_recv() lang = desc[1] if ARG == "bal" and ARG2 is not None: N = ctx.guild.get_member(ge.nom_ID(ARG2)).name else: N = ctx.author.name if desc[0] == "bal": if ARG2 != None: ID = ge.nom_ID(ARG2) nom = ctx.guild.get_member(ID) ARG2 = nom.name title = lang_P.forge_msg(lang, "bank", [N], False) # title = "Compte épargne de {}".format(ARG2) else: title = lang_P.forge_msg(lang, "bank", [N], False) # title = "Compte épargne de {}".format(ctx.author.name) msg = discord.Embed(title=title, color=13752280, description="", timestamp=dt.datetime.now()) msg.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url) msg.add_field(name="Balance", value=desc[2], inline=False) msg.add_field(name="Commandes", value=desc[3], inline=False) await ctx.channel.send(embed=msg) elif desc[0] == "add": msg = discord.Embed(title=lang_P.forge_msg(lang, "titres", None, False, 4), color=13752280, description=desc[2], timestamp=dt.datetime.now()) msg.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url) await ctx.channel.send(embed=msg) elif desc[0] == "saving": msg = discord.Embed(title=lang_P.forge_msg(lang, "titres", None, False, 5), color=13752280, description=desc[2], timestamp=dt.datetime.now()) msg.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url) await ctx.channel.send(embed=msg) else: await ctx.channel.send(desc[2])
async def info(self, ctx, Nom=None): """ Permet d'avoir les informations d'un utilisateur """ if Nom == None: ID = ctx.author.id Nom = ctx.author.name else: ID = ge.nom_ID(Nom) if ID != -1: if not level.checkInfo(ID): member = ctx.guild.get_member(int(ID)) await ge.addrole(member, "Nouveau") PlayerID = requests.get( 'http://{ip}/users/playerid/{discord_id}'.format( ip=ge.API_IP, discord_id=ID)).json()['ID'] user = requests.get('http://{ip}/users/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID)).json() lvl = int(user['level']) xp = int(user['xp']) nbmsg = int(user['nbmsg']) reaction = int(user['nbreaction']) msg = "**Utilisateur:** {}".format(Nom) emb = discord.Embed(title="Informations", color=13752280, description=msg) if ctx.guild.id == wel.idBASTION: # Niveaux part msg = "" palier = level.lvlPalier(lvl) msg += "XP: `{0}/{1}`\n".format(xp, palier) msg += "Messages: `{0}`\n".format(nbmsg) msg += "Réactions: `{0}`\n".format(reaction) emb.add_field(name="**_Niveau_ : {0}**".format(lvl), value=msg, inline=False) # Parrainage P = user['godparent'] F_li = requests.get( 'http://{ip}/users/godchilds/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID)).json() nbF = int( requests.get( 'http://{ip}/users/godchilds/count/{player_id}'.format( ip=ge.API_IP, player_id=PlayerID)).text) msg = "" if P != 0: msg += "\nParrain: <@{0}>".format( requests.get('http://{ip}/users/{player_id}'.format( ip=ge.API_IP, player_id=P)).json()['discord_id']) else: msg += "\nParain: `None`" if nbF != 0: if nbF > 1: sV = "s" else: sV = "" msg += "\nFilleul{1} `x{0}`:".format(nbF, sV) for one in F_li: msg += "\n<@{0}>".format(one['discord_id']) emb.add_field(name="**_Parrainage_**", value=msg, inline=False) # await bot.delete_message(ctx.message) await ctx.channel.send(embed=emb) else: await ctx.channel.send( "Commande utilisable uniquement sur le discord Bastion!") else: msg = "Le nom que vous m'avez donné n'existe pas !" await ctx.channel.send(msg)