Merge pull request #164 from bobloy/werewolf_develop

Werewolf bugfixes
pull/168/head
bobloy 4 years ago committed by GitHub
commit bae50f6a7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -59,4 +59,4 @@
'cog: unicode': 'cog: unicode':
- unicode/* - unicode/*
'cog: werewolf': 'cog: werewolf':
- werewolf - werewolf/*

@ -15,19 +15,11 @@ from werewolf.builder import (
role_from_id, role_from_id,
role_from_name, role_from_name,
) )
from werewolf.game import Game from werewolf.game import Game, anyone_has_role
log = logging.getLogger("red.fox_v3.werewolf") log = logging.getLogger("red.fox_v3.werewolf")
async def anyone_has_role(
member_list: List[discord.Member], role: discord.Role
) -> Union[None, discord.Member]:
return await AsyncIter(member_list).find(
lambda m: AsyncIter(m.roles).find(lambda r: r.id == role.id)
)
class Werewolf(Cog): class Werewolf(Cog):
""" """
Base to host werewolf on a guild Base to host werewolf on a guild
@ -263,6 +255,7 @@ class Werewolf(Cog):
game = await self._get_game(ctx) game = await self._get_game(ctx)
if not game: if not game:
await ctx.maybe_send_embed("No game running, cannot start") await ctx.maybe_send_embed("No game running, cannot start")
return
if not await game.setup(ctx): if not await game.setup(ctx):
pass # ToDo something? pass # ToDo something?
@ -285,6 +278,7 @@ class Werewolf(Cog):
game = await self._get_game(ctx) game = await self._get_game(ctx)
game.game_over = True game.game_over = True
if game.current_action:
game.current_action.cancel() game.current_action.cancel()
await ctx.maybe_send_embed("Game has been stopped") await ctx.maybe_send_embed("Game has been stopped")

Loading…
Cancel
Save