Open jkl2k2 opened 2 years ago
Are you sure the issue is related to the use of editReply()? Wouldn't discord.js give an error stating such instead of saying it's a non-existent function? I'm wondering if #34 is caused by them using the interaction version of the package on a message.
could be the case ngl, but 3 people are experiencing it so I'm not sure
and if changing it to reply() fixed it for them, then the wrong package couldn't be the issue
Hmm, did it fix the issue? I don't see any responses after #35 was merged. Either way, changing it to editReply() fixed it for me due to the aforementioned issue with replying to a deferred interaction.
From testing it, calling the interaction version of the package on a message results in the exact error mentioned in #34 (since, obviously, messages don't have an editReply() function). Calling it on an interaction without the fix results in an error saying the interaction has already been deferred or replied to. So that's why I think #34 is caused by an error on the bot dev's side and not the package.
EDIT: Also, calling editReply() on an interaction reply that hasn't been sent yet, as #35 had mentioned, will error with the message "Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred", and not the error that was reported in #34.
Here's some examples of the testing I did with a command I'm working on:
Using paginationEmbed with a message instead of an interaction (using the wrong package version).
Using paginationEmbed without the change:
Using paginationEmbed with the fix I made:
Hmm okay, I'll look into it
Any updates? I am having this issue as well
Has been updated to v3.0.0, kindly install from npm
// Gives the user a menu to choose from.
interaction
.reply({
ephemeral: false,
embeds: [menu],
components: [menuRow],
fetchReply: true,
})
.then(() => {
const filter = (i) => {
i.deferUpdate();
return i.user.id === interaction.user.id;
};
interaction.channel
.awaitMessageComponent({
filter,
componentType: "BUTTON",
time: 30000,
})
.then((choice) => {
if (choice.customId === "btn_Featured") {
paginationEmbed(interaction, featuredPages, navButtons, 30000)
}
})
.catch(function (error) {
console.log(error);
});
});
So, if I try to create this new paginated embed, by clicking on a button of another interaction, I get this error as well. Any way to go around this?
EDIT: I fixed my problem by deleting the if (interaction.deferred) condition in your index.js
I noticed that every time I called "paginationEmbed()" I would receive an error stating that the Interaction has already been "sent or deferred". I dug around the code and found that commit 95a0108 in PR #35 seems to cause this.
Since line 36 guarantees that the interaction will be deferred, the next reply has to be an editReply() call and not reply(). Otherwise, the reply() call occurring right after guaranteeing the interaction is deferred will always error no matter what.