switch to log

pull/147/head
bobloy 4 years ago
parent 98ae481d14
commit 84ed2728e7

@ -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:

@ -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)

@ -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

@ -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`")

Loading…
Cancel
Save