-
-
Notifications
You must be signed in to change notification settings - Fork 480
Closed
Labels
unconfirmed bugA bug report that needs triagingA bug report that needs triaging
Description
Summary
Slash command with Option of type str and min/max length values raise AttributeError
Bot fails when trying to load a cog that has such command.
Reproduction Steps
Create slash commands with Option of type str and min/max length and try to register it
Minimal Reproducible Code
@commands.slash_command()
async def test(
self, ctx: discord.ApplicationContext,
message: Option(str, min_length=1, max_length=1024),
):
...Expected Results
The option should be accepted correctly
Actual Results
Traceback (most recent call last):
File "/home/*/.local/lib/python3.8/site-packages/discord/cog.py", line 730, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/*/ybr/cogs/*.py", line 14, in <module>
class *(commands.Cog):
File "/home/*/ybr/cogs/*.py", line 61, in *
message: Option(str, "*", min_length=1, max_length=1024),
File "/home/*/.local/lib/python3.8/site-packages/discord/commands/options.py", line 247, in __init__
raise AttributeError('Option does not take min_length or max_length if not of type str')
AttributeError: Option does not take min_length or max_length if not of type str
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "main.py", line 7, in <module>
client = *()
File "/home/*/ybr/utils/client.py", line 26, in __init__
self.load_extension('cogs.*')
File "/home/*/.local/lib/python3.8/site-packages/discord/cog.py", line 850, in load_extension
self._load_from_module_spec(spec, name)
File "/home/*/.local/lib/python3.8/site-packages/discord/cog.py", line 733, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.*' raised an error: AttributeError: Option does not take min_length or max_length if not of type str
Intents
discord.Intents.all()
System Information
- Python v3.8.13-final
- py-cord v2.0.0-final
- aiohttp v3.8.1
- system info: Linux 5.4.0-122-generic Merge restructure into slash #138-Ubuntu SMP Wed Jun 22 15:00:31 UTC 2022
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
No response
Metadata
Metadata
Assignees
Labels
unconfirmed bugA bug report that needs triagingA bug report that needs triaging