devRael1 / discordjs-pagination

A pagination system for Discord.js v14
https://www.npmjs.com/package/@devraelfreeze/discordjs-pagination
MIT License
11 stars 10 forks source link

does on work on dm's #7

Closed jmpangilinan closed 1 year ago

jmpangilinan commented 1 year ago

I tried to use in on dm's, it has error

TypeError: Cannot read properties of null (reading 'send')
    at pagination (D:\Github\...\node_modules\@devraelfreeze\discordjs-pagination\dist\pagination\pagination.js:91:40)
jmpangilinan commented 1 year ago

changed it too

await interaction.deferReply({ ephemeral: ephemeralMessage });
initialMessage = await interaction.editReply({
    embeds: [changeFooter()],
    components: components()
});

its worked

devRael1 commented 1 year ago

Oh !

Can you send me the code you used to create this error ? So I can know how to patch the bug.

jmpangilinan commented 1 year ago
await pagination({
              embeds: embeds, // Array of embeds objects
              author: interaction.user,
              interaction: interaction,
              time: 180000, // 40 seconds
              disableButtons: true, // Remove buttons after timeout
              fastSkip: false,
              pageTravel: false,
              buttons: [
                  {
                      type: ButtonTypes.previous,
                      label: 'Previous Page',
                      style: ButtonStyles.Primary
                  },
                  {
                      type: ButtonTypes.next,
                      label: 'Next Page',
                      style: ButtonStyles.Success
                  }
              ]
          }).catch(function (){});

This work's on guild channels, but when using when DM on bot, it produces the error above.

devRael1 commented 1 year ago

interaction: interaction,

The interaction has been deferred or replied before ?

jmpangilinan commented 1 year ago

interaction: interaction,

The interaction has been deferred or replied before ?

no, interaction not yet deferred or replied

devRael1 commented 1 year ago

Ok thx you i will fix this