mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-03 16:50:03 +00:00
Add support for discord.Thread annotation in app commands
This commit is contained in:
parent
6d55b96fa7
commit
863df7d049
@ -47,6 +47,7 @@ from typing import (
|
|||||||
from .errors import AppCommandError, TransformerError
|
from .errors import AppCommandError, TransformerError
|
||||||
from .models import AppCommandChannel, AppCommandThread, Choice
|
from .models import AppCommandChannel, AppCommandThread, Choice
|
||||||
from ..channel import StageChannel, VoiceChannel, TextChannel, CategoryChannel
|
from ..channel import StageChannel, VoiceChannel, TextChannel, CategoryChannel
|
||||||
|
from ..threads import Thread
|
||||||
from ..enums import Enum as InternalEnum, AppCommandOptionType, ChannelType
|
from ..enums import Enum as InternalEnum, AppCommandOptionType, ChannelType
|
||||||
from ..utils import MISSING, maybe_coroutine
|
from ..utils import MISSING, maybe_coroutine
|
||||||
from ..user import User
|
from ..user import User
|
||||||
@ -574,6 +575,7 @@ CHANNEL_TO_TYPES: Dict[Any, List[ChannelType]] = {
|
|||||||
ChannelType.category,
|
ChannelType.category,
|
||||||
],
|
],
|
||||||
AppCommandThread: [ChannelType.news_thread, ChannelType.private_thread, ChannelType.public_thread],
|
AppCommandThread: [ChannelType.news_thread, ChannelType.private_thread, ChannelType.public_thread],
|
||||||
|
Thread: [ChannelType.news_thread, ChannelType.private_thread, ChannelType.public_thread],
|
||||||
StageChannel: [ChannelType.stage_voice],
|
StageChannel: [ChannelType.stage_voice],
|
||||||
VoiceChannel: [ChannelType.voice],
|
VoiceChannel: [ChannelType.voice],
|
||||||
TextChannel: [ChannelType.text, ChannelType.news],
|
TextChannel: [ChannelType.text, ChannelType.news],
|
||||||
@ -590,6 +592,7 @@ BUILT_IN_TRANSFORMERS: Dict[Any, Type[Transformer]] = {
|
|||||||
Role: passthrough_transformer(AppCommandOptionType.role),
|
Role: passthrough_transformer(AppCommandOptionType.role),
|
||||||
AppCommandChannel: channel_transformer(AppCommandChannel, raw=True),
|
AppCommandChannel: channel_transformer(AppCommandChannel, raw=True),
|
||||||
AppCommandThread: channel_transformer(AppCommandThread, raw=True),
|
AppCommandThread: channel_transformer(AppCommandThread, raw=True),
|
||||||
|
Thread: channel_transformer(Thread),
|
||||||
StageChannel: channel_transformer(StageChannel),
|
StageChannel: channel_transformer(StageChannel),
|
||||||
VoiceChannel: channel_transformer(VoiceChannel),
|
VoiceChannel: channel_transformer(VoiceChannel),
|
||||||
TextChannel: channel_transformer(TextChannel),
|
TextChannel: channel_transformer(TextChannel),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user