more refactoring
This commit is contained in:
parent
b85c20b65a
commit
13064a3af0
8 changed files with 51 additions and 40 deletions
Binary file not shown.
|
|
@ -1,3 +1,5 @@
|
|||
"""Has a single class: Werewolf_Cog"""
|
||||
|
||||
# discord imports
|
||||
from discord.ext import commands
|
||||
|
||||
|
|
@ -6,12 +8,12 @@ from ..game_cog import Game_cog
|
|||
from .game import Werewolf_game
|
||||
|
||||
|
||||
class Werewolf_cog(Game_cog):
|
||||
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?
|
||||
# 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()
|
||||
|
|
@ -29,6 +31,24 @@ class Werewolf_cog(Game_cog):
|
|||
"""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, None))
|
||||
bot.add_cog(Werewolf_cog(bot, Werewolf_game))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue