jowsey / discord.js-menu

💬 Create Discord.js embed-menus, with customizable reactions and unlimited pages.
https://npm.im/discord.js-menu
MIT License
120 stars 19 forks source link

Support for attachment updates #20

Open LukeEllis opened 3 years ago

LukeEllis commented 3 years ago

Attachments currently cannot be updated via .edit(). I was playing around with a solution to allow for attachment update support, but am running into a few errors.

Reference line in index.js

// in setPage

// this.menu.edit(this.currentPage.content)

this.menu.delete(this.currentPage.content)
this.menu.channel.send(this.currentPage.content)

Rather than editing the embed content, we must delete and send a new message if the attachment is updated. This seems to break some other functionality, as once I get to a second page everything loads except the reactions. Happy to contribute a solution if this addition makes sense, just need some clarity on where to look.

Video showing menu flow/errors

Paste of example code with changing attachments

Here are the errors I received (all permissions are granted to the bot in the server):

[discord.js-menu] DiscordAPIError: Unknown Message (whilst trying to remove message reactions) | You're probably missing 'MANAGE_MESSAGES' in #larvitus-testing (Erster's Stellaris Addiction Server), needed for removing reactions when changing pages.

[discord.js-menu] DiscordAPIError: Unknown Message (whilst trying to add reactions to message) | You're probably missing 'ADD_REACTIONS' in #larvitus-testing (Erster's Stellaris Addiction Server), needed for adding reactions to the page.

[discord.js-menu] DiscordAPIError: Unknown Message (whilst trying to add reactions to message) | You're probably missing 'ADD_REACTIONS' in #larvitus-testing (Erster's Stellaris Addiction Server), needed for adding reactions to the page.

[discord.js-menu] DiscordAPIError: Unknown Message (whilst trying to remove message reactions) | You're probably missing 'MANAGE_MESSAGES' in #larvitus-testing (Erster's Stellaris Addiction Server), needed for removing reactions when changing pages.

I'm thinking this is caused by the new page being a new message, so the bot doesn't know what message it's trying to apply a reaction collector to?

P.S. Thank you for the wonderful library!