From 3082061cae84c3ec67c5687eb82dc62b672ec05d Mon Sep 17 00:00:00 2001 From: Hipstercat Date: Mon, 31 Aug 2020 20:26:35 +0200 Subject: [PATCH] configure verbose (fix) --- cogs/wynncraft/wynncraftcog.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cogs/wynncraft/wynncraftcog.py b/cogs/wynncraft/wynncraftcog.py index 06f13df..f96b982 100644 --- a/cogs/wynncraft/wynncraftcog.py +++ b/cogs/wynncraft/wynncraftcog.py @@ -68,7 +68,7 @@ class WynncraftCog(commands.Cog): else: await ctx.send(":x:") - def _log(self, s): + async def _log(self, s): if await self.config.log(): print(s) @@ -76,16 +76,16 @@ class WynncraftCog(commands.Cog): await self.bot.wait_until_ready() last_status = {} while self is self.bot.get_cog("WynncraftCog"): - self._log("Looping guilds") + await self._log("Looping guilds") async for guild in self.bot.fetch_guilds(limit=150): guild_id = guild.id - self._log("Loop id %s" % guild_id) + await self._log("Loop id %s" % guild_id) try: channel_id = await self.config.guild(guild).channel() if channel_id: - self._log("Channel set") + await self._log("Channel set") for tracked in await self.config.guild(guild).tracked(): - self._log("calling API for player %s" % tracked) + await self._log("calling API for player %s" % tracked) r = requests.get("https://api.wynncraft.com/v2/player/%s/stats" % tracked).json() for cl in r["data"][0]["classes"]: if guild_id not in last_status: @@ -101,11 +101,11 @@ class WynncraftCog(commands.Cog): channel = self.bot.get_channel(channel_id) await channel.send(":high_brightness: %s a level up au niveau %s! GG!" % (tracked, cl["professions"]["combat"]["level"])) else: - self._log("Player %s had last level %s and current %s" % (tracked, last_status[guild_id][tracked][cl["name"]]["professions"]["combat"]["level"], cl["professions"]["combat"]["level"])) + await self._log("Player %s had last level %s and current %s" % (tracked, last_status[guild_id][tracked][cl["name"]]["professions"]["combat"]["level"], cl["professions"]["combat"]["level"])) last_status[guild_id][tracked][cl["name"]] = cl else: - self._log("Guild has no channel set") + await self._log("Guild has no channel set") except: if await self.config.log(): traceback.print_exc()