Markoudstaal / node-red-contrib-discord-advanced

Recieve, send, edit and delete Discord messages in node-red.
MIT License
46 stars 16 forks source link

Listen for slash commands with autocomplete #81

Closed moshed closed 11 months ago

moshed commented 1 year ago

I would like to be able to receive slash commands with autocomplete so I can let the user choose from a list of of more than 25 items total (see the /giphy command which allows you to choose from millions of gifs based on if your query matches the gif tags) but it seems that I can only receive the message once the user finishes filling everything out.

If I set the interaction type to All instead of Command I get a message anytime any character is typed but it throws an error and gives TypeError: interaction.deferUpdate is not a function

see this section in the api docs for more info.

im not sure if I registered the command properly but I passed the below object to the HTTP POST request node

msg = {
    url: 'https://discord.com/api/v10/applications/[id]/commands',
    payload: {
        name: 'mlb_player',
        description: 'mlb player',
        options: [{
            name: 'query',
            description: 'search for a player',
            type: 3,
            autocomplete: true,
            required: true
        }]
    },
    headers: {
        'Content-Type': 'application/json',
        Authorization: 'Bot [token]'
    }
}
return msg
javis86 commented 11 months ago

97