From 1d0d029531051f7cb101cc6b41e572dc17ff0ff8 Mon Sep 17 00:00:00 2001 From: Hipstercat Date: Thu, 19 Nov 2020 20:11:01 +0100 Subject: [PATCH] fix !perso command --- cogs/wynncraft/wynncraftcog.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cogs/wynncraft/wynncraftcog.py b/cogs/wynncraft/wynncraftcog.py index 9a10311..b498406 100644 --- a/cogs/wynncraft/wynncraftcog.py +++ b/cogs/wynncraft/wynncraftcog.py @@ -300,6 +300,7 @@ class WynncraftCog(commands.Cog): @commands.command() async def quefaire(self, ctx, explicit_level: int = 0): + author_id = str(ctx.author.id) hints = [] if explicit_level == 0: # check for class then quests @@ -310,10 +311,9 @@ class WynncraftCog(commands.Cog): return persos = await self.config.guild(ctx.guild).persos() - await self._log(persos) max_class = None - if ctx.author.id in persos: - wanted_class = persos[ctx.author.id] + if author_id in persos: + wanted_class = persos[author_id] for cl in req["data"][0]["classes"]: if cl["name"] == wanted_class: max_class = cl @@ -436,9 +436,10 @@ class WynncraftCog(commands.Cog): @commands.command() async def perso(self, ctx, class_str: str = None): + author_id = str(ctx.author.id) persos = await self.config.guild(ctx.guild).persos() if not class_str: - if ctx.author.id in persos: + if author_id in persos: await ctx.send(":white_check_mark: Ton perso défini est : %s" % persos[ctx.author.id]) return else: @@ -447,7 +448,7 @@ class WynncraftCog(commands.Cog): player_name = ctx.author.display_name req = requests.get("https://api.wynncraft.com/v2/player/%s/stats" % player_name).json() if not req["data"]: - await ctx.send(":x: impossible de t'aider, je ne te trouve pas sur Wynncraft :(") + await ctx.send(":x: Impossible de t'aider, je ne te trouve pas sur Wynncraft :(") return valid = False @@ -457,13 +458,12 @@ class WynncraftCog(commands.Cog): break if not valid: - await ctx.send(":x: ce perso n'existe pas :(") + await ctx.send(":x: Ce perso n'existe pas :(") return - persos[ctx.author.id] = class_str + persos[author_id] = class_str await self.config.guild(ctx.guild).persos.set(persos) await ctx.send(":white_check_mark: Ton perso est désormais %s !" % class_str) - await self._log(persos) @commands.command() @checks.admin_or_permissions(manage_guild=True)