Repository: Pycord-Development/pycord

Issue:
SlashCommandOptionType not support Thread class
### Summary

SlashCommandOptionType not support Thread class

### Reproduction Steps

Set `discord.Thread` as `input_type` in `Option`

### Minimal Reproducible Code

```python
@slash_command(name="Test")
async def test(ctx, channel: Option(discord.Thread)):
    print("Test")
```


### Expected Results

Can show only `Thread` channel, or `Thread` with `TextChannel` channels

### Actual Results

TypeError: Invalid class <class 'discord.threads.Thread'> used as an input type for an Option

### Intents

all

### System Information

- Python v3.9.5-final 
- py-cord v2.0.0-alpha
    - py-cord pkg_resources: v2.0.0a4409+g16e7aff6
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.19043

### 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:
Well this is basically because a thread is not a real channel.

@Lulalaby is this supported on the API? I don't recall seeing this in the API docs.
https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
https://discord.com/developers/docs/resources/channel#channel-object-channel-types
@BobDotCom 

![image](https://user-images.githubusercontent.com/54180221/142737599-84ba56e4-414b-47c4-b598-5ba9577e3d17.png)


^ this

Resolving patch:
diff --git a/discord/commands/commands.py b/discord/commands/commands.py
--- a/discord/commands/commands.py
+++ b/discord/commands/commands.py
@@ -32,7 +32,7 @@
 import re
 import types
 from collections import OrderedDict
-from typing import Any, Callable, Dict, Generator, Generic, List, Optional, Type, TypeVar, Union, TYPE_CHECKING
+from typing import Any, Callable, Dict, Generator, Generic, List, Literal, Optional, Type, TypeVar, Union, TYPE_CHECKING
 
 from .context import ApplicationContext, AutocompleteContext
 from .errors import ApplicationCommandError, CheckFailure, ApplicationCommandInvokeError
@@ -750,9 +750,23 @@ def _update_copy(self, kwargs: Dict[str, Any]):
     'TextChannel': ChannelType.text,
     'VoiceChannel': ChannelType.voice,
     'StageChannel': ChannelType.stage_voice,
-    'CategoryChannel': ChannelType.category
+    'CategoryChannel': ChannelType.category,
+    'Thread': ChannelType.public_thread
 }
 
+class ThreadOption:
+    def __init__(self, thread_type: Literal["public", "private", "news"]):
+        type_map = {
+            "public": ChannelType.public_thread,
+            "private": ChannelType.private_thread,
+            "news": ChannelType.news_thread,
+        }
+        self._type = type_map[thread_type]
+    
+    @property
+    def __name__(self):
+        return 'ThreadOption'
+
 class Option:
     def __init__(
         self, input_type: Any, /, description: str = None, **kwargs
@@ -774,6 +788,9 @@ def __init__(
                     for i in input_type:
                         if i.__name__ == 'GuildChannel':
                             continue
+                        if isinstance(i, ThreadOption):
+                            self.channel_types.append(i._type)
+                            continue
 
                         channel_type = channel_type_map[i.__name__]
                         self.channel_types.append(channel_type)
diff --git a/discord/enums.py b/discord/enums.py
--- a/discord/enums.py
+++ b/discord/enums.py
@@ -643,21 +643,13 @@ def from_datatype(cls, datatype):
             else:
                 raise TypeError('Invalid usage of typing.Union')
 
-        if issubclass(datatype, str):
-            return cls.string
-        if issubclass(datatype, bool):
-            return cls.boolean
-        if issubclass(datatype, int):
-            return cls.integer
-        if issubclass(datatype, float):
-            return cls.number
-
         if datatype.__name__ in ["Member", "User"]:
             return cls.user
         if datatype.__name__ in [
             "GuildChannel", "TextChannel",
             "VoiceChannel", "StageChannel",
-            "CategoryChannel"
+            "CategoryChannel", "ThreadOption",
+            "Thread",
         ]:
             return cls.channel
         if datatype.__name__ == "Role":
@@ -665,6 +657,15 @@ def from_datatype(cls, datatype):
         if datatype.__name__ == "Mentionable":
             return cls.mentionable
 
+        if issubclass(datatype, str):
+            return cls.string
+        if issubclass(datatype, bool):
+            return cls.boolean
+        if issubclass(datatype, int):
+            return cls.integer
+        if issubclass(datatype, float):
+            return cls.number
+
         # TODO: Improve the error message
         raise TypeError(f'Invalid class {datatype} used as an input type for an Option')
 


Test patch: