Repository: Pycord-Development/pycord

Issue:
AttributeError: 'SlashCommandGroup' object has no attribute '_callback'.
### Summary

Can't use CogMeta(command_attrs=...) with defined SlashCommandGroup in cog.

### Reproduction Steps

1. Create cog with defined command_attrs.
2. Define SlashCommandGroup in this cog.

### Minimal Reproducible Code

```python
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

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.

### Additional Context

_No response_


Discussion:
I changed line in `2.4.x` https://github.com/Pycord-Development/pycord/blob/9d4d0f705c604c17661d916b5b43d37bc8e4013f/discord/commands/core.py#L1370 to `copy = self.__class__(**kw)` and now everything works.

P.S. this line in `master` https://github.com/Pycord-Development/pycord/blob/fc7b1042c4a9a942b9996dfe96f56aac059e179c/discord/commands/core.py#L1442

Resolving patch:
diff --git a/discord/commands/core.py b/discord/commands/core.py
--- a/discord/commands/core.py
+++ b/discord/commands/core.py
@@ -1444,7 +1444,7 @@ def _update_copy(self, kwargs: dict[str, Any]):
         if kwargs:
             kw = kwargs.copy()
             kw.update(self.__original_kwargs__)
-            copy = self.__class__(self.callback, **kw)
+            copy = self.__class__(**kw)
             return self._ensure_assignment_on_copy(copy)
         else:
             return self.copy()


Test patch: