Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Allow passing a simple array for autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Jun 16, 2024
1 parent b087913 commit 4da07b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Commands/SlashCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ protected function handleAutocomplete(Collection $options, Interaction $interact
$value = Arr::get($this->autocomplete(), $path);

if ($option->focused && $value) {
$choices = $value($interaction, $option->value);
$choices = is_callable($value)
? $value($interaction, $option->value)
: Arr::wrap($value);

return collect($choices)->map(function ($choice, $key) use ($choices) {
if ($choice instanceof Choice) {
Expand Down

0 comments on commit 4da07b1

Please sign in to comment.