Repository: Pycord-Development/pycord

Issue:
Error in cog bridge command ctx annotation
### Summary

Annotating ctx in bridge command inside a cog raises error

### Reproduction Steps

Run the following code

### Minimal Reproducible Code

```python
import os

from discord.ext.commands import Cog
from discord.ext.bridge import Bot, BridgeContext, bridge_command


class A(Cog):
    @bridge_command()
    async def cmd(self, ctx: BridgeContext):
        await ctx.send("ok")


bot = Bot()
bot.add_cog(A())
bot.run(os.getenv("TOKEN"))
```


### Expected Results

The bot working fine (it works without the annotation)

### Actual Results

```
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/DandelionMusic/repro5.py", line 7, in <module>
    class A(Cog):
  File "/data/data/com.termux/files/home/DandelionMusic/repro5.py", line 8, in A
    @bridge_command()
     ^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/bridge/core.py", line 424, in decorator
    return BridgeCommand(callback, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/bridge/core.py", line 167, in __init__
    ) or BridgeSlashCommand(callback, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/bridge/core.py", line 82, in __init__
    super().__init__(func, **kwargs)
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/commands/core.py", line 693, in __init__
    self._validate_parameters()
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/commands/core.py", line 711, in _validate_parameters
    self.options = self._parse_options(params)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/commands/core.py", line 769, in _parse_options
    option = Option(option)
             ^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/commands/options.py", line 231, in __init__
    raise exc
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/commands/options.py", line 226, in __init__
    self.input_type = SlashCommandOptionType.from_datatype(input_type)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/enums.py", line 815, in from_datatype
    raise TypeError(
TypeError: Invalid class <class 'discord.ext.bridge.context.BridgeContext'> used as an input type for an Option
```

### Intents

None

### System Information

/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/__main__.py:33: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
- Python v3.11.6-final
- py-cord v2.4.1-final
- aiohttp v3.9.1
- system info: `Linux 4.14.232-QuicksilveR™-ReloadedOS-Edition #1 SMP PREEMPT Wed May 26 07:08:17 UTC 2021`

### 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:

Resolving patch:
diff --git a/discord/enums.py b/discord/enums.py
--- a/discord/enums.py
+++ b/discord/enums.py
@@ -808,9 +808,10 @@ def from_datatype(cls, datatype):
             return cls.number
 
         from .commands.context import ApplicationContext
+        from .ext.bridge import BridgeContext
 
         if not issubclass(
-            datatype, ApplicationContext
+            datatype, (ApplicationContext, BridgeContext)
         ):  # TODO: prevent ctx being passed here in cog commands
             raise TypeError(
                 f"Invalid class {datatype} used as an input type for an Option"


Test patch: