55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
"""Has a single class: Werewolf_Cog"""
|
|
|
|
# discord imports
|
|
from discord.ext import commands
|
|
|
|
# local imports
|
|
from ..game_cog import Game_cog
|
|
from .game import Werewolf_game
|
|
|
|
|
|
class Werewolf_cog(Game_cog, commands.Cog):
|
|
"""This singleton class is a Discord Cog for the interaction in the werewolf game"""
|
|
|
|
@commands.group(invoke_without_command=True)
|
|
async def werewolf(self, ctx):
|
|
# TODO: isn't there a better way to have a default subcommand? Maybe invoke super().info()?
|
|
await ctx.invoke(self.bot.get_command('werewolf info'))
|
|
|
|
@werewolf.command()
|
|
async def info(self, ctx):
|
|
"""Send information about the subcommands for the game"""
|
|
await super().info(ctx, Werewolf_game)
|
|
|
|
@werewolf.command()
|
|
async def setup(self, ctx):
|
|
"""This function creates an game instance for this channel"""
|
|
await super().setup(ctx, Werewolf_game)
|
|
|
|
@werewolf.command()
|
|
async def reset(self, ctx):
|
|
"""This function deletes the game instance for this channel"""
|
|
await super().reset(ctx)
|
|
|
|
@werewolf.command()
|
|
@commands.check(Game_cog.pre_game_check)
|
|
async def players(self, ctx):
|
|
"""registers all mentioned players for the game"""
|
|
await super().players(ctx)
|
|
|
|
@werewolf.command()
|
|
@commands.check(Game_cog.pre_game_check)
|
|
async def start(self, ctx):
|
|
"""starts a round of werewolf"""
|
|
await super().start(ctx)
|
|
|
|
@werewolf.command()
|
|
@commands.check(Game_cog.in_game_check)
|
|
async def stop(self, ctx):
|
|
"""aborts the current round of werewolf"""
|
|
await super().stop(ctx)
|
|
|
|
|
|
def setup(bot):
|
|
bot.add_cog(Werewolf_cog(bot, Werewolf_game))
|