We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Cannot set multiple type for arg in slash command
@slash_command() async def test(self, ctx, channel: Option([discord.TextChannel, discord.VoiceChannel])): print(channel)
Traceback (most recent call last): File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 705, in _load_from_module_spec spec.loader.exec_module(lib) # type: ignore File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "c:\Users\Andrew\Documents\tuflya\cogs\sendmsg.py", line 8, in <module> class sendmsg(commands.Cog): File "c:\Users\Andrew\Documents\tuflya\cogs\sendmsg.py", line 14, in sendmsg channel: Option([discord.TextChannel, discord.VoiceChannel], "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043a\u0430\u043d\u0430\u043b"), File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\options.py", line 72, in __init__ _type = SlashCommandOptionType.from_datatype(input_type) File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\enums.py", line 670, in from_datatype if datatype.__name__ in ["Member", "User"]: AttributeError: 'list' object has no attribute '__name__'. Did you mean: '__ne__'?
channel arg should accept both types
can't use multiple-type in slash command
default, members
Python Version: 3.10 Pycord Version: 2.0.0b4
No response
The text was updated successfully, but these errors were encountered:
Try to pass a tuple of channel types, not a list of them. I'm going to open a PR to accept lists of channel types.
Sorry, something went wrong.
Have you tried SlashCommandOptionType.channel (for your use case)?
So they should update their example https://github.com/Pycord-Development/pycord/blob/master/examples/app_commands/slash_options.py#L25
slash_options.py
Successfully merging a pull request may close this issue.
Summary
Cannot set multiple type for arg in slash command
Reproduction Steps
Minimal Reproducible Code
Expected Results
channel arg should accept both types
Actual Results
can't use multiple-type in slash command
Intents
default, members
System Information
Python Version: 3.10
Pycord Version: 2.0.0b4
Checklist
Additional Context
No response
The text was updated successfully, but these errors were encountered: