diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 3fcfd808..f4a3918d 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -529,6 +529,9 @@ class BotBase(GroupMixin): cog = cog._inject(self) self.__cogs[cog.__cog_name__] = cog + if cog.aliases: + for alias in cog.aliases: + self.__cogs[alias] = cog def get_cog(self, name): """Gets the cog instance requested. @@ -567,6 +570,10 @@ class BotBase(GroupMixin): if cog is None: return + if cog.aliases: + for alias in cog.aliases: + self.__cogs.pop(alias) + help_command = self._help_command if help_command and help_command.cog is cog: help_command.cog = None diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index 774f5317..5430852e 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -98,6 +98,11 @@ class CogMeta(type): attrs['__cog_name__'] = kwargs.pop('name', name) attrs['__cog_settings__'] = command_attrs = kwargs.pop('command_attrs', {}) + aliases = kwargs.pop('aliases', []) + if not isinstance(aliases, list): + raise TypeError("Cog aliases must be a list, not a {0}".format(type(aliases))) + attrs['aliases'] = aliases + description = kwargs.pop('description', None) if description is None: description = inspect.cleandoc(attrs.get('__doc__', ''))