Autocomplete options - what is the value property for?

A related question was asked here: https://discord.com/channels/222078108977594368/1035366885891506278 I'm trying to do the same thing as them (show just one word as an autocomplete option, but when they select the option, it only appends it to the end of their current input), but I have a more specific question. Autocomplete options take an object with required properties name and value, but usually people set them to the same thing, so they don't care about the differences between the properties. Like this:
interaction.respond([{
name: "hello",
value: "hello",
}]);
interaction.respond([{
name: "hello",
value: "hello",
}]);
What I assumed at first was that the name property is displayed to the user, but when they click the option, the value property would replace their input. But that didn't work. After experimenting, I found that the value property actually has no effect whatsoever on the autocomplete interaction. These next two examples have the exact same results - the user sees the name property ("hello") when viewing the autocomplete options, and when clicking it, their input is completely replaced by the name property ("hello").
interaction.respond([{
name: "hello",
value: "hello world",
}]);
interaction.respond([{
name: "hello",
value: "hello world",
}]);
and
interaction.respond([{
name: "hello",
value: "jblaklqwerpoij,a,l1!@#LTQRqnwj",
}]);
interaction.respond([{
name: "hello",
value: "jblaklqwerpoij,a,l1!@#LTQRqnwj",
}]);
So what is the point of the value field? Or is this a bug?
6 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
isaacg
isaacgOP3y ago
hmm i think i see
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
isaacg
isaacgOP3y ago
but so if I had an option with name "hello", and the user manually types the word "hello", would the bot still receive the value field? if the user didn't click the autocomplete choice?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
isaacg
isaacgOP3y ago
oh ok too bad then thanks for the help though
Want results from more Discord servers?
Add your server