Compare commits

...

2 Commits

5 changed files with 22 additions and 31 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
secrets.env secrets.env
.env .env
venv venv
src/__pycache__/ __pycache__/
src/test.py src/test.py

View File

@ -37,6 +37,18 @@ class Werewolf_cog(Game_cog, commands.Cog):
"""registers all mentioned players for the game""" """registers all mentioned players for the game"""
await super().players(ctx) 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() @werewolf.command()
@commands.check(Game_cog.pre_game_check) @commands.check(Game_cog.pre_game_check)
async def start(self, ctx): async def start(self, ctx):
@ -49,6 +61,12 @@ class Werewolf_cog(Game_cog, commands.Cog):
"""aborts the current round of werewolf""" """aborts the current round of werewolf"""
await super().stop(ctx) 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): def setup(bot):
bot.add_cog(Werewolf_cog(bot, Werewolf_game)) bot.add_cog(Werewolf_cog(bot, Werewolf_game))

View File

@ -3,7 +3,7 @@ import time
import asyncio import asyncio
import discord import discord
from .roles import Role, Doppelganger, Werewolf, Minion, Mason, Seer, Robber, Troublemaker, Drunk, Insomniac, Tanner, Hunter, No_role 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: class Werewolf_game:
@ -27,7 +27,7 @@ class Werewolf_game:
await asyncio.gather(*[call(p) for p in self.player_list]) await asyncio.gather(*[call(p) for p in self.player_list])
async def set_players(self, msg): 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 await self.send(f"Players: {', '.join(p.name() for p in self.player_list)}") # send confirmation
async def set_roles(self, suggestions): async def set_roles(self, suggestions):

View File

@ -1,9 +1,7 @@
import discord
"""Has a single class: Werewolf_player""" """Has a single class: Werewolf_player"""
# local import # local import
from .player import Player from ..players import Player
class Werewolf_player(Player): class Werewolf_player(Player):

View File

@ -50,29 +50,4 @@ def error_handling(command):
return wrapper 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) bot.run(TOKEN)