Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ephemeral option #33

Closed
MadsIBA opened this issue Dec 3, 2021 · 3 comments
Closed

Add ephemeral option #33

MadsIBA opened this issue Dec 3, 2021 · 3 comments

Comments

@MadsIBA
Copy link

MadsIBA commented Dec 3, 2021

Hello.

First of all, thank you for making my life more simple with this package.
However, this might be due to my lacking knowledge about programming, but I wish for an option to make the embed + buttons ephemeral.

usually I would have something like:
interaction.reply({ embeds: [embed], ephemeral: true });
but I'm not sure how I'm supposed to make that work with this package.

@ryzyx
Copy link
Owner

ryzyx commented Dec 4, 2021

Just fork the repository and make changes accordingly. If u need help with that lmk. Also best of luck with programming, welcome to the coding industry :D

@MadsIBA
Copy link
Author

MadsIBA commented Dec 4, 2021

Right so I've been testing this issue:

Added ephemeral to line 11 of the code:
const paginationEmbed = async (interaction, pages, buttonList, timeout = 120000, ephemeral) => {

Added ephemeral to line 24 of the code:
//has the interaction already been deferred? If not, defer the reply. if (interaction.deferred == false) { await interaction.deferReply({ ephemeral: ephemeral }); }

Everything works fine until the timeout kicks in that gives me a Unhandled promise rejection: DiscordAPIError: Unknown Message error

For now my programming skills aren't sufficient enough to solve this or figure why this is happening.

This is full error code I get:

Unhandled promise rejection: DiscordAPIError: Unknown Message
    at RequestHandler.execute (<repopath>\node_modules\discord.js\src\rest\RequestHandler.js:349:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (<repopath>\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async MessageManager.edit (<repopath>\node_modules\discord.js\src\managers\MessageManager.js:131:15) {
  method: 'patch',
  path: '/channels/913966573360918579/messages/916778196458946561',
  code: 10008,
  httpStatus: 404,
  requestData: {
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: [Array],
      components: [Array],
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: 64,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined
    },
    files: []
  }
}

@ryzyx
Copy link
Owner

ryzyx commented Dec 6, 2021

you're defer replying to the interaction, hence no curPage creates and is undefined

@ryzyx ryzyx closed this as completed Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants