Closed

Description
Summary
Can't use CogMeta(command_attrs=...) with defined SlashCommandGroup in cog.
Reproduction Steps
- Create cog with defined command_attrs.
- Define SlashCommandGroup in this cog.
Minimal Reproducible Code
import discord
class EggsCog(discord.Cog, command_attrs=dict(guild_only=True)):
slashgroup = discord.SlashCommandGroup(name="foobar")
bot = discord.Bot()
bot.add_cog(EggsCog())
Expected Results
guild_only=True
attr will be applied to slashgroup.
Actual Results
Traceback (most recent call last):
File "/home/user/test/main.py", line 4, in <module>
class EggsCog(discord.Cog, command_attrs=dict(guild_only=True)):
File "/home/user/test/venv/lib/python3.11/site-packages/discord/cog.py", line 233, in __new__
new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) if not hasattr(c, "add_to") else c for c in new_cls.__cog_commands__) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/test/venv/lib/python3.11/site-packages/discord/cog.py", line 233, in <genexpr>
new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) if not hasattr(c, "add_to") else c for c in new_cls.__cog_commands__) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/test/venv/lib/python3.11/site-packages/discord/commands/core.py", line 1370, in _update_copy
copy = self.__class__(self.callback, **kw)
^^^^^^^^^^^^^
File "/home/user/test/venv/lib/python3.11/site-packages/discord/commands/core.py", line 261, in callback
return self._callback
^^^^^^^^^^^^^^
AttributeError: 'SlashCommandGroup' object has no attribute '_callback'. Did you mean: 'callback'?
Intents
N/A
System Information
- Python v3.11.2-final
- py-cord v2.4.1-final
- aiohttp v3.8.6
- system info: Linux
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
No response