From 4714fe512774c1cfc583cbb6e638eef15cad6ae0 Mon Sep 17 00:00:00 2001 From: bibin Date: Mon, 4 Jan 2021 01:14:14 +0100 Subject: [PATCH] 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 --- src/cogs/basic_game.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cogs/basic_game.py b/src/cogs/basic_game.py index 41864af..30a52fd 100644 --- a/src/cogs/basic_game.py +++ b/src/cogs/basic_game.py @@ -6,7 +6,13 @@ from discord.ext import commands class Cog(commands.Cog): """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: