From 84ed2728e7ce29f3e97282b43f8af0b8776a742e Mon Sep 17 00:00:00 2001 From: bobloy Date: Thu, 24 Sep 2020 13:36:42 -0400 Subject: [PATCH] switch to log --- werewolf/game.py | 16 ++++++++-------- werewolf/role.py | 2 +- werewolf/roles/vanillawerewolf.py | 4 ++-- werewolf/werewolf.py | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/werewolf/game.py b/werewolf/game.py index 7372923..45f0cbd 100644 --- a/werewolf/game.py +++ b/werewolf/game.py @@ -203,8 +203,7 @@ class Game: reason="(BOT) New game of werewolf", ) except discord.Forbidden as e: - print("Unable to rename Game Channel") - print(e) + log.exception("Unable to rename Game Channel") await ctx.send("Unable to rename Game Channel, ignoring") try: @@ -222,11 +221,11 @@ class Game: return self.started = True # Assuming everything worked so far - print("Pre at_game_start") + log.debug("Pre at_game_start") await self._at_game_start() # This will queue channels and votegroups to be made - print("Post at_game_start") + log.debug("Post at_game_start") for channel_id in self.p_channels: - print("Channel id: " + channel_id) + log.debug("Setup Channel id: " + channel_id) overwrite = { self.guild.default_role: discord.PermissionOverwrite(read_messages=False), self.guild.me: discord.PermissionOverwrite( @@ -258,7 +257,7 @@ class Game: self.vote_groups[channel_id] = vote_group - print("Pre-cycle") + log.debug("Pre-cycle") await asyncio.sleep(1) await asyncio.ensure_future(self._cycle()) # Start the loop @@ -566,7 +565,8 @@ class Game: await member.add_roles(*[self.game_role]) except discord.Forbidden: await channel.send( - f"Unable to add role **{self.game_role.name}**\nBot is missing `manage_roles` permissions" + f"Unable to add role **{self.game_role.name}**\n" + f"Bot is missing `manage_roles` permissions" ) await channel.send( @@ -899,7 +899,7 @@ class Game: # Remove game_role access for potential archiving for now reason = "(BOT) End of WW game" for obj in self.to_delete: - print(obj) + log.debug(f"End_game: Deleting object {obj}") await obj.delete(reason=reason) try: diff --git a/werewolf/role.py b/werewolf/role.py index 0693f46..ccc20ae 100644 --- a/werewolf/role.py +++ b/werewolf/role.py @@ -129,7 +129,7 @@ class Role(WolfListener): return "Default" @wolflistener("at_game_start", priority=1) - async def _at_game_start(self, data=None): + async def _at_game_start(self): if self.channel_id: await self.game.register_channel(self.channel_id, self) diff --git a/werewolf/roles/vanillawerewolf.py b/werewolf/roles/vanillawerewolf.py index db70eb5..f6eea81 100644 --- a/werewolf/roles/vanillawerewolf.py +++ b/werewolf/roles/vanillawerewolf.py @@ -57,9 +57,9 @@ class VanillaWerewolf(Role): return "Werewolf" @wolflistener("at_game_start") - async def _at_game_start(self, data=None): + async def _at_game_start(self): if self.channel_id: - print("Wolf has channel_id: " + self.channel_id) + log.debug("Wolf has channel_id: " + self.channel_id) await self.game.register_channel( self.channel_id, self, WolfVote ) # Add VoteGroup WolfVote diff --git a/werewolf/werewolf.py b/werewolf/werewolf.py index a011ccb..742a890 100644 --- a/werewolf/werewolf.py +++ b/werewolf/werewolf.py @@ -47,7 +47,7 @@ class Werewolf(Cog): return def __unload(self): - print("Unload called") + log.debug("Unload called") for game in self.games.values(): del game @@ -182,7 +182,7 @@ class Werewolf(Cog): Joins a game of Werewolf """ - game = await self._get_game(ctx) + game: Game = await self._get_game(ctx) if not game: await ctx.send("No game to join!\nCreate a new one with `[p]ww new`")