diff --git a/.gitignore b/.gitignore index 6b0dd66..4e78b90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ secrets.env .env venv -src/__pycache__/ +__pycache__/ src/test.py \ No newline at end of file diff --git a/src/package/games/werewolf/cog.py b/src/package/games/werewolf/cog.py index 65b88ca..d210fd1 100644 --- a/src/package/games/werewolf/cog.py +++ b/src/package/games/werewolf/cog.py @@ -37,6 +37,18 @@ class Werewolf_cog(Game_cog, commands.Cog): """registers all mentioned players for the game""" await super().players(ctx) + @werewolf.command() + @commands.check(Game_cog.pre_game_check) + async def roles(self, ctx, *args): + """registers roles you want to play with""" + await self.game_instances[ctx.channel].set_roles(args) + + @werewolf.command() + @commands.check(Game_cog.pre_game_check) + async def minutes(self, ctx, i): + """set discussion time""" + await self.game_instances[ctx.channel].set_time(i) + @werewolf.command() @commands.check(Game_cog.pre_game_check) async def start(self, ctx): @@ -49,6 +61,12 @@ class Werewolf_cog(Game_cog, commands.Cog): """aborts the current round of werewolf""" await super().stop(ctx) + @werewolf.command() + @commands.check(Game_cog.in_game_check) + async def time(self, ctx): + """checks how much discussion time there is left""" + await self.send_friendly(ctx, self.game_instances[ctx.channel].remaining_time_string()) + def setup(bot): bot.add_cog(Werewolf_cog(bot, Werewolf_game)) diff --git a/src/package/games/werewolf/game.py b/src/package/games/werewolf/game.py index 4d1b9ee..34fe62d 100644 --- a/src/package/games/werewolf/game.py +++ b/src/package/games/werewolf/game.py @@ -3,7 +3,7 @@ import time import asyncio import discord from .roles import Role, Doppelganger, Werewolf, Minion, Mason, Seer, Robber, Troublemaker, Drunk, Insomniac, Tanner, Hunter, No_role -from .players import Player, No_player +from .players import Werewolf_player, No_player class Werewolf_game: @@ -27,7 +27,7 @@ class Werewolf_game: await asyncio.gather(*[call(p) for p in self.player_list]) async def set_players(self, msg): - self.player_list = [await Player.make(mem, self) for mem in msg.mentions] + self.player_list = [await Werewolf_player.make(mem, self) for mem in msg.mentions] await self.send(f"Players: {', '.join(p.name() for p in self.player_list)}") # send confirmation async def set_roles(self, suggestions): diff --git a/src/package/games/werewolf/players.py b/src/package/games/werewolf/players.py index a17ab9c..443f075 100644 --- a/src/package/games/werewolf/players.py +++ b/src/package/games/werewolf/players.py @@ -1,9 +1,7 @@ -import discord - """Has a single class: Werewolf_player""" # local import -from .player import Player +from ..players import Player class Werewolf_player(Player): diff --git a/src/werewolf_bot.py b/src/werewolf_bot.py index 9fb47b9..31a4a22 100644 --- a/src/werewolf_bot.py +++ b/src/werewolf_bot.py @@ -50,29 +50,4 @@ def error_handling(command): return wrapper ''' -''' - -# TODO: (specifig game) werewolf COG - -@game.command() -@game_not_running -@error_handling -async def roles(ctx, *args): - await game_instances[ctx.channel].set_roles(args) - - -@game.command() -@game_not_running -@error_handling -async def minutes(ctx, i): - await game_instances[ctx.channel].set_time(i) - - -@game.command() -@game_running -@error_handling -async def time(ctx): - await send_friendly(ctx, game_instances[ctx.channel].remaining_time_string()) -''' - bot.run(TOKEN)