added player comd

This commit is contained in:
Amazed 2020-09-07 20:07:13 +02:00
parent 9f78563eea
commit 495dc70b05

View File

@ -135,6 +135,24 @@ class WynncraftCog(commands.Cog):
await self.config.guild(ctx.guild).guild_name.set(guild_name) await self.config.guild(ctx.guild).guild_name.set(guild_name)
await ctx.send(":white_check_mark: Votre guilde est désormais **%s**" % guild_name) await ctx.send(":white_check_mark: Votre guilde est désormais **%s**" % guild_name)
@commands.command()
async def player(self, ctx, player_name):
req = requests.get("https://api.wynncraft.com/v2/player/%s/stats" % player_name).json()
if not req["data"]:
await ctx.send(":x: joueur non trouvé")
return
player_data = req["data"][0]
real_player_name = player_data["username"]
output = "**__%s__**" % real_player_name
output += ":black_small_square: **Joueur depuis:** %s\n" % player_data["meta"]["firstJoin"]
output += ":black_small_square: **Niveau total:** %s\n" % player_data["global"]["totalLevel"]["combat"]
for c in player_data["classes"]:
output += ":diamond_shape_with_a_dot_inside: **%s:** %s\n" % (c["name"], c["professions"]["combat"]["level"])
await ctx.send(output)
@commands.command() @commands.command()
@checks.is_owner() @checks.is_owner()
async def log(self, ctx, state): async def log(self, ctx, state):