mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
[commands] Add GroupCog.group_extras to set Group.extras
Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
This commit is contained in:
parent
9ea6ee8887
commit
bdda31307b
@ -145,6 +145,12 @@ class CogMeta(type):
|
|||||||
than :class:`str`. Defaults to ``True``.
|
than :class:`str`. Defaults to ``True``.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
group_extras: :class:`dict`
|
||||||
|
A dictionary that can be used to store extraneous data.
|
||||||
|
This is only applicable for :class:`GroupCog` instances.
|
||||||
|
The library will not touch any values or keys within this dictionary.
|
||||||
|
|
||||||
|
.. versionadded:: 2.1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__cog_name__: str
|
__cog_name__: str
|
||||||
@ -153,6 +159,7 @@ class CogMeta(type):
|
|||||||
__cog_group_description__: Union[str, app_commands.locale_str]
|
__cog_group_description__: Union[str, app_commands.locale_str]
|
||||||
__cog_group_nsfw__: bool
|
__cog_group_nsfw__: bool
|
||||||
__cog_group_auto_locale_strings__: bool
|
__cog_group_auto_locale_strings__: bool
|
||||||
|
__cog_group_extras__: Dict[Any, Any]
|
||||||
__cog_settings__: Dict[str, Any]
|
__cog_settings__: Dict[str, Any]
|
||||||
__cog_commands__: List[Command[Any, ..., Any]]
|
__cog_commands__: List[Command[Any, ..., Any]]
|
||||||
__cog_app_commands__: List[Union[app_commands.Group, app_commands.Command[Any, ..., Any]]]
|
__cog_app_commands__: List[Union[app_commands.Group, app_commands.Command[Any, ..., Any]]]
|
||||||
@ -183,6 +190,7 @@ class CogMeta(type):
|
|||||||
attrs['__cog_group_name__'] = group_name
|
attrs['__cog_group_name__'] = group_name
|
||||||
attrs['__cog_group_nsfw__'] = kwargs.pop('group_nsfw', False)
|
attrs['__cog_group_nsfw__'] = kwargs.pop('group_nsfw', False)
|
||||||
attrs['__cog_group_auto_locale_strings__'] = kwargs.pop('group_auto_locale_strings', True)
|
attrs['__cog_group_auto_locale_strings__'] = kwargs.pop('group_auto_locale_strings', True)
|
||||||
|
attrs['__cog_group_extras__'] = kwargs.pop('group_extras', {})
|
||||||
|
|
||||||
description = kwargs.pop('description', None)
|
description = kwargs.pop('description', None)
|
||||||
if description is None:
|
if description is None:
|
||||||
@ -306,6 +314,7 @@ class Cog(metaclass=CogMeta):
|
|||||||
guild_ids=getattr(cls, '__discord_app_commands_default_guilds__', None),
|
guild_ids=getattr(cls, '__discord_app_commands_default_guilds__', None),
|
||||||
guild_only=getattr(cls, '__discord_app_commands_guild_only__', False),
|
guild_only=getattr(cls, '__discord_app_commands_guild_only__', False),
|
||||||
default_permissions=getattr(cls, '__discord_app_commands_default_permissions__', None),
|
default_permissions=getattr(cls, '__discord_app_commands_default_permissions__', None),
|
||||||
|
extras=cls.__cog_group_extras__,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
group = None
|
group = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user