-
I have command "price". I want to add multiple autocomplete to these fields: "weapon", "skin", "condition" Here is my code:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I've seen a similar issue with #1285, but I'm still unsure of the exact root cause. The CommandBuilder class no longer has this issue after updating the method to use a Collection and I was able to use autocompletions without an issue in the context of ->save() with the below sample code. Also keep in mind that the choices must be passed when the command is saved. I do not recognize what you are trying to do in your code sample, but I've never written a slash command using the autocomplete_callback parameter before. $server_choices = [];
foreach ($this->civ13->enabled_gameservers as &$gameserver) {
$server_choices[] = [
'name' => $gameserver->name,
'value' => $gameserver->key
];
};
if ($server_choices) { // Only add the ranking commands if there are servers to choose from
if (! $commands->get('name', 'rank')) $this->save($commands, new Command($this->discord, [
'name' => 'rank',
'description' => 'See your ranking on a Civ13 server',
'dm_permission' => false,
'options' => [
[
'name' => 'server',
'description' => 'Which server to look up rankings for',
'type' => Option::STRING,
'required' => true,
'choices' => $server_choices
],
[
'name' => 'ckey',
'description' => 'Byond.com username',
'type' => Option::STRING,
'required' => false
]
]
]));
} |
Beta Was this translation helpful? Give feedback.
-
I have found solution:
|
Beta Was this translation helpful? Give feedback.
I have found solution: