discord-interactions-js icon indicating copy to clipboard operation
discord-interactions-js copied to clipboard

application modal throws invalid interaction after upgrade

Open santgr11 opened this issue 1 year ago • 1 comments

I was using 3.2.0, in one place I return an APPLICATION_MODAL, after upgrading to 3.4.0 the interaction returning the 200 with the exact same component throws invalid interacion in discord.

Im returning the component like this:

{
  type: InteractionResponseType.APPLICATION_MODAL,
  data: {
    title: 'Insert code.',
    custom_id: 'associate-code',
    components: [
      {
        type: 1,
        components: [
          {
            type: 4,
            custom_id: 'associate-code',
            label: 'Associate Code',
            style: 2,
            min_length: 12,
            max_length: 12,
            placeholder: 'Insert code',
            required: true
          }
        ]
      }
    ]
  }
}

santgr11 avatar Sep 13 '23 17:09 santgr11

There was a good clue in your question.

InteractionResponseType.APPLICATION_MODAL doesn't exist anymore you should use InteractionResponseType.MODAL (https://github.com/discord/discord-interactions-js/blob/955d77b857dc798f46914cd2b9e4bf59de429f8f/src/index.ts#L61C7-L61C7)

Docs should be updated too (https://github.com/discord/discord-interactions-js/blob/main/examples/modal_example.js) can make an PR if needed and still maintained

Waxo avatar Nov 12 '23 11:11 Waxo