Este es mi evento para verificar que el usuario agregue reaccionar:
const client = require("../index"); client.on('messageReactionAdd', async (reaction, user) => { if (user.bot) return; console.log(reaction.emoji.name); });Está funcionando, pero cuando el bot se reinicia, ¿no puede recuperar ningún mensaje enviado antes?
¿Por qué y cómo solucionarlo?
Si no habilita estructuras parciales, su código solo funciona en mensajes almacenados en caché, los que se publican después de que el bot está conectado. Reaccionar a mensajes más antiguos no activará el evento messageReactionAdd . Si también desea escuchar reacciones en mensajes antiguos, debe habilitar estructuras parciales para MESSAGE , CHANNEL y REACTION al crear una instancia de su cliente, como esta:
const client = new Discord.Client({ intents: [/* YOUR INTENTS */], partials: ['MESSAGE', 'CHANNEL', 'REACTION'], });Necesitas parciales:
const client = new Client({ intents: '', // your intents here partials: ['CHANNEL', 'GUILD_MEMBER', 'GUILD_SCHEDULED_EVENT', 'MESSAGE', 'REACTION', 'USER'], });