acegoal07 / discordjs-pagination

A pagination package for Discord.js
https://acegoal07.dev
MIT License
6 stars 3 forks source link

[FEATURE REQUEST] Support for <interaction>#deferReply() and ephemeral responses #13

Closed GlxryX closed 2 years ago

GlxryX commented 2 years ago

Currently, deferring a response triggers the following error when set to ephemeral and deleting the response after about 5 seconds.

DiscordAPIError[10008]: Unknown Message
    at SequentialHandler.runRequest (C:\Users\user\Documents\GitHub\Octave\node_modules\@discordjs\rest\dist\index.js:748:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\user\Documents\GitHub\Octave\node_modules\@discordjs\rest\dist\index.js:560:14)
    at async REST.request (C:\Users\user\Documents\GitHub\Octave\node_modules\@discordjs\rest\dist\index.js:1000:22)
    at async MessageManager.edit (C:\Users\user\Documents\GitHub\Octave\node_modules\discord.js\src\managers\MessageManager.js:166:15) {
  rawError: { message: 'Unknown Message', code: 10008 },
  code: 10008,
  status: 404,
  method: 'PATCH',
  url: 'https://discord.com/api/v10/channels/1001337826505412658/messages/1001626861337583666',
  requestBody: {
    files: [],
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: undefined,
      components: [Array],
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: 64,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined
    }
  }
}

It would be nice to have an option to work with deferred or ephemeral responses.

acegoal07 commented 2 years ago

This seems to be caused by the check to see if the message still exists as defferd and ephemeral interactions are supported already

Try running the code with just the deffer and see if you still get the same error

acegoal07 commented 2 years ago

I have fixed the error and I have also taken your feedback and made it so you can enable ephemeral on non deferred interactions through the pagination this will come in version 1.3.5

GlxryX commented 2 years ago

Thank you. Massive respect for being so responsive šŸ™

acegoal07 commented 2 years ago

Thank you. Massive respect for being so responsive šŸ™

If you would like you can test out the new version to see if the error is fixed for you as well and also try out the new feature