Feat: Add constructor for basic_game Cog

Initializes bot like a regular Cog
Initializes an empty session dictionary
Initializes the class of the session with a possible default value
Changes the group command name to the Cog's name to avoid name clashes in commands
This commit is contained in:
Bibin Muttappillil 2021-01-04 01:14:14 +01:00
parent 1d8ed8f2ea
commit 4714fe5127
1 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,13 @@ from discord.ext import commands
class Cog(commands.Cog): class Cog(commands.Cog):
"""A base game cog that has a collection of basic game commands and checkers""" """A base game cog that has a collection of basic game commands and checkers"""
pass
def __init__(self, bot, session_cls=None):
self.bot = bot
self.sessions = {}
self.session_cls = Session if session_cls is None else session_cls
self.group = next(c for c in self.get_commands() if c.name == 'group')
self.group.name = self.qualified_name.lower()
class Session: class Session: