How to listen to button interactions for any message

Creating and receiving button interactions are really simple - but the problem is once I restart the bot it does not listen to the buttons in old messages anymore. That's a problem when it comes to a "Button role system". Now how do I receive button interactions from the old messages? Current code:
client.on("interactionCreate", async interaction => {
if (interaction.isButton()) {
console.log("Received interaction");
}
});
client.on("interactionCreate", async interaction => {
if (interaction.isButton()) {
console.log("Received interaction");
}
});
9 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
RiskyMH
RiskyMH2y ago
you could create a database to store the diferan't data (could be just json), or you could store the state (ie role to add) in the message id.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Rakin
Rakin2y ago
but it doesn't -
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Rakin
Rakin2y ago
okay it does not log anything looks like it did not emit the event
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Rakin
Rakin2y ago
yes
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View