Environment
- PHP Version:
- DiscordPHP Version:
Describe the bug
The autocomplete handler is not properly called when the called command is a subcommand. Autocomplete works perfectly fine on commands without subcommands.
To Reproduce
See below.
Expected behavior
See below.
Additional context
I've tracked down the issue to this method, where I var_dump-ed the $option->focused value and it seemed to have not properly assigned in the options instance:
|
if ($subCommand = $command->getSubCommand($option->name)) { |
|
if ($option->focused) { |
|
return $subCommand->suggest($interaction); |
|
} |
|
if (! empty($option->options)) { |
|
return $this->checkCommand($subCommand, $option->options, $interaction); |
|
} |
|
} elseif ($option->focused) { |
The option value is focused => true as expected and the $subCommand->suggest(...) should be called properly, but the call to $option->focused returns null - I'm not sure where exactly to fix this.
object(Discord\Parts\Interactions\Request\Option)#118 (3) {
["attributes"]=>
array(3) {
["name"]=>
string(3) "set"
["type"]=>
int(1)
["options"]=>
array(1) {
[0]=>
object(stdClass)#315 (4) {
["value"]=>
string(0) ""
["type"]=>
int(3)
["name"]=>
string(2) "id"
["focused"]=>
bool(true)
}
}
}
["created"]=>
&bool(true)
["class"]=>
string(41) "Discord\Parts\Interactions\Request\Option"
}
Environment
Describe the bug
The autocomplete handler is not properly called when the called command is a subcommand. Autocomplete works perfectly fine on commands without subcommands.
To Reproduce
See below.
Expected behavior
See below.
Additional context
I've tracked down the issue to this method, where I
var_dump-ed the$option->focusedvalue and it seemed to have not properly assigned in the options instance:DiscordPHP/src/Discord/WebSockets/Events/InteractionCreate.php
Lines 110 to 117 in 9018330
The option value is
focused => trueas expected and the$subCommand->suggest(...)should be called properly, but the call to$option->focusedreturnsnull- I'm not sure where exactly to fix this.