Repository: Pycord-Development/pycord

Issue:
Slash command callbacks do not reload
### Summary

According to a recent feature request https://github.com/Pycord-Development/pycord/issues/917, the ability to reload the callback of slash commands has already been added. It does not, however, seem to work for me.

### Reproduction Steps

Change some code in a slash command callback and reload the cog that contains the command.

### Minimal Reproducible Code

**Main Bot File:**
```python

import discord
bot = discord.Bot()
bot.load_extension('test')

@bot.slash_command()
async def reload(ctx):
    bot.reload_extension("test")
    await ctx.respond('Reloaded test.')

bot.run("TOKEN")
```

**Test Cog:**
```python
from discord.ext import commands
from discord.commands import slash_command

class Test(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @slash_command()
    async def test(self, ctx):
        await ctx.respond("Test1")

def setup(bot):
    bot.add_cog(Test(bot))
```

Run this bot, then change `await ctx.respond("Test1")` to `await ctx.respond("Test2")` and use /reload.


### Expected Results

The command is reloaded, and in my example, using /test would respond with "Test2".

### Actual Results

The command is not reloaded, and in my example, the bot still responds with "Test1" even after a reload.

### Intents

None

### System Information

- Python v3.10.1-final
- py-cord v2.0.0-beta
    - py-cord pkg_resources: v2.0.0b4
- aiohttp v3.8.1
- system info: Windows 10 10.0.19044

### 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

I asked in the Discord server, and at least one other person is experiencing the same issue.


Discussion:
Just want to add to this that there was a suggestion in discord to call `await bot.sync_commands()` after attempting a /reload, but there was no change, it still produced the same result: that is, it did not actually seem to reload the callback.
I can reproduce this. I dont know how it got broken.
Are you using the latest `master` branch version?
I was not when I made this issue, but I just tried it with the latest master branch and the result was exactly the same.
> I was not when I made this issue, but I just tried it with the latest master branch and the result was exactly the same.

Did you try it with using `sync_commands`?
Indeed, I tried both with and without `sync_commands`.
The reason this is broken is probably that the old implementation was made to work with the old command registration, I will try to make a new implementation.
Is your fix already implemented or do you have a schedule for it? Reloading the slash command still doesn't work on my side with the version py-cord==2.0.0b5.

Resolving patch:
diff --git a/discord/commands/core.py b/discord/commands/core.py
--- a/discord/commands/core.py
+++ b/discord/commands/core.py
@@ -174,7 +174,7 @@ def __repr__(self) -> str:
         return f"<discord.commands.{self.__class__.__name__} name={self.name}>"
 
     def __eq__(self, other) -> bool:
-        if hasattr(self, "id") and hasattr(other, "id"):
+        if getattr(self, "id", None) is not None and getattr(other, "id", None) is not None:
             check = self.id == other.id
         else:
             check = self.name == other.name and self.guild_ids == self.guild_ids


Test patch: