Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support providing option channel types as list #1000

Merged
merged 4 commits into from Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion discord/commands/options.py
Expand Up @@ -79,7 +79,7 @@ def __init__(self, input_type: Any, /, description: str = None, **kwargs) -> Non
input_type = SlashCommandOptionType.string
else:
if _type == SlashCommandOptionType.channel:
if not isinstance(input_type, tuple):
if not isinstance(input_type, (tuple, list)):
Dorukyum marked this conversation as resolved.
Show resolved Hide resolved
input_type = (input_type,)
for i in input_type:
if i.__name__ == "GuildChannel":
Expand Down
2 changes: 1 addition & 1 deletion discord/enums.py
Expand Up @@ -658,7 +658,7 @@ class SlashCommandOptionType(Enum):

@classmethod
def from_datatype(cls, datatype):
if isinstance(datatype, tuple): # typing.Union has been used
if isinstance(datatype, (tuple, list)): # typing.Union has been used
Dorukyum marked this conversation as resolved.
Show resolved Hide resolved
datatypes = [cls.from_datatype(op) for op in datatype]
if all(x == cls.channel for x in datatypes):
return cls.channel
Expand Down