Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 0749355

Browse files
committed
fixed Could not find a matching option type
1 parent 981415d commit 0749355

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ You can find more (and better) examples [here](https://github.com/discord-py-ui/
176176

177177
# Changelog
178178

179+
- <details>
180+
<summary>4.3.2</summary>
181+
182+
## **Fixed**
183+
- `Could not find a matching option type for parameter '<class 'NoneType'>'`
184+
185+
</details>
186+
179187
- <details>
180188
<summary>4.3.1</summary>
181189

discord_ui/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@
4646

4747

4848
__title__ = "discord-ui"
49-
__version__ = "4.3.1"
49+
__version__ = "4.3.2"

discord_ui/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def command(ctx: SlashedCommand):
8282
8383
...
8484
@slash.subcommand_group(base_names=["base", "group"], name="sub", description="this is a sub command group")
85-
async def subgroup(ctx: SlasedSubCommand):
85+
async def subgroup(ctx: SlashedSubCommand):
8686
...
8787
8888

discord_ui/receive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ def __init__(self, client, command: SlashCommand, data, user, args = None) -> No
335335
class SlashedSubCommand(SlashedCommand, SlashSubcommand):
336336
"""A Sub-:class:`~SlashCommand` command that was used"""
337337
def __init__(self, client, command, data, user, args = None) -> None:
338-
SlashSubcommand.__init__(self, command.callback, command.base_names, command.name)
339338
SlashedCommand.__init__(self, client, command, data, user, args)
339+
SlashSubcommand.__init__(self, command.callback, command.base_names, command.name, command.description, command.options, command.guild_ids, command.default_permission, command.guild_permissions)
340340

341341

342342
class SlashedContext(Interaction, ContextCommand):

discord_ui/slash/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,22 +367,22 @@ def __init__(self, command_type, callback, name=None, description=None, options=
367367
raise NoAsyncCallback()
368368

369369
callback_params = inspect.signature(callback).parameters
370-
if options is not None:
370+
if self.options is not None:
371371
for op in options:
372372
if callback_params.get(op.name) is None:
373373
raise MissingOptionParameter(op.name)
374374
param = callback_params[op.name]
375375
if not op.required and param.default is param.empty:
376376
raise OptionalOptionParameter(param.name)
377-
if _none(options, empty_array=True) and self.command_type is CommandType.Slash:
377+
if self.options in [[], None] and self.command_type is CommandType.Slash:
378378
_ops = []
379379
has_self = False
380380
for _i, _name in enumerate(callback_params):
381381
# ignore context parameter
382382
if _name == "self":
383383
has_self = True
384384
continue
385-
if _i == [0, 1][has_self]:
385+
if _i == (1 if has_self else 0):
386386
continue
387387
_val = callback_params.get(_name)
388388
op_type = None

0 commit comments

Comments
 (0)