#autocomplete help
1 messages · Page 1 of 1 (latest)
teh wierd thing is it doesnt
it this line of code even reached? add a few more console.logs
you also might want to move the require call outside the callback, unless you're dealing with circular requires there's no need to do it here and not at the top
wierd
if(cmd.inputs.includes('fetch')){if(cmd.inputs.includes('fetch_required')){cmd.data.addNumberOption(option=>option.setName('fetch').setDescription('fetch value').setRequired(true).setAutocomplete(true))}else cmd.data.addNumberOption(option=>option.setName('fetch').setDescription('fetch value').setAutocomplete(true))}
const {fetchAuditLog}=require('../functions')
module.exports={
name:'get',
description:'Get audit log entries',
inputs:'fetch',
execute(bot,interaction){
}
}
it shows the autocomplete and all, but doesnt trigger the interaction.isAutocomplete()
did you redeploy the command with the autocomplete addition?
by redeploy u mean restart the bot?
I mean executing your deploy-command script or whatever you use to deploy them
so u mean reregistering it
yes
what happens in discord when you run the command and type something in the autocompleted option?
oh, it threw an error:
DiscordAPIError: Invalid Form Body
data.choices[0].value: This field is required
<:_:874569335308431382> AutocompleteInteraction#respond()
Sends results for the autocomplete of this interaction.
has to be { name, value }
{"name":"get","values":[{"name":"All","value":null},{"name":"Guild update","value":1},{"name":"Channel create","value":10}]}
this is what is in the options.json
so you need to respond with what's inside "values"
DiscordAPIError: Invalid Form Body
data.choices[0]: Only dictionaries may be used in a ModelType
``` ???
you did not respond with an array of objects (aka dictionaries in python)
{ name: 'All', value: null },
{ name: 'Guild update', value: 1 },
{ name: 'Channel create', value: 10 }
thats what i responded
is that inside an array? because you respond with [option]
it is array of objects
so you are responding with an array of arrays
so [[option.values]] ?
will value: null be a problem?
if i provide the fetch auditlog with "null" will it still return all?
i mean null in string
it's a number option so you can just respond with -1 and handle that in your code
ye, if(smt==-1) smt = null