Discord.js-为什么MessageReactionaAdd事件被完全阻止?

Discord.js-为什么MessageReactionaAdd事件被完全阻止?,discord.js,Discord.js,我一直在尝试创建一个不和谐机器人。很多交互都是通过反应完成的,我知道只有缓存的消息触发了MessageReactionaAdd事件。因此,我选择了下面的一段代码,它应该发出与添加到“old”(未缓存)消息中的反应相对应的数据包。但它似乎完全阻止了任何与反应有关的数据包,因为现在没有任何数据包发出。是不是我做错了什么? 谢谢 我的“raw.js”文件: 我的“事件获取程序”: 从#faq频道: 错误: •“messageReactionAdd”即使启用了正确的部分,也不会触发 PR:(合并,等待发

我一直在尝试创建一个不和谐机器人。很多交互都是通过反应完成的,我知道只有缓存的消息触发了MessageReactionaAdd事件。因此,我选择了下面的一段代码,它应该发出与添加到“old”(未缓存)消息中的反应相对应的数据包。但它似乎完全阻止了任何与反应有关的数据包,因为现在没有任何数据包发出。是不是我做错了什么? 谢谢

我的“raw.js”文件:

我的“事件获取程序”:

#faq
频道:

错误:

“messageReactionAdd”
即使启用了正确的部分,也不会触发

PR:(合并,等待发布)

临时修复是为了确保在客户端定义中添加
GUILD\u成员
partial

newdiscord.Client({
部分:[“用户”、“公会成员”、“频道”、“消息”、“反应”],
});
module.exports = {
    run: (client, packet) => {

        // We don't want this to run on unrelated packets
        if (!['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) return;
        // Grab the channel to check the message from
        const channel = client.guilds.cache.get(packet.d.guild_id).channels.cache.get(packet.d.channel_id);

        const messageID = packet.d.message_id;
        // There's no need to emit if the message is cached, because the event will fire anyway for that
        if (channel.messages.has(messageID)) return;

        // Since we have confirmed the message is not cached, let's fetch it
        channel.messages.fetch(messageID).then(message => {
            // Emojis can have identifiers of name:id format, so we have to account for that case as well
            const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name;
            // This gives us the reaction we need to emit the event properly, in top of the message object
            const reaction = message.reactions.get(emoji);
            // Adds the currently reacting user to the reaction's users collection.
            if (reaction) reaction.users.set(packet.d.user_id, client.users.get(packet.d.user_id));
            // Check which type of event it is before emitting
            if (packet.t === 'MESSAGE_REACTION_ADD') {
                client.emit('messageReactionAdd', reaction, client.users.get(packet.d.user_id));
            }
            if (packet.t === 'MESSAGE_REACTION_REMOVE') {
                client.emit('messageReactionRemove', reaction, client.users.get(packet.d.user_id));
            }
        });
    }
};
const fs = require('fs')

fs.readdir('./events/', (err, files) => {
    if (err) return console.error(err);
    files.forEach((file) => {
        const eventFunction = require(`./events/${file}`);
        if (eventFunction.disabled) return;

        const event = eventFunction.event || file.split('.')[0];
        const emitter = (typeof eventFunction.emitter === 'string' ? client[eventFunction.emitter] : eventFunction.emitter) || client;
        const { once } = eventFunction;

        try {
            emitter[once ? 'once' : 'on'](event, (...args) => eventFunction.run(client, ...args));
        } catch (error) {
            console.error(error.stack);
        }
    });
});