对我的机器人嵌入集的反应,作者被告知窝反应,但是我不希望机器人被列出

时间:2020-01-09 17:41:46

标签: javascript embed discord

我将如何关闭发送漫游器响应(我的嵌入设置了一些响应供成员使用)?这样,只有当真人做出反应时,才是dm,而不是机器人在嵌入程序中设置第一个反应时?

预先感谢

https://pastebin.com/XNfbuZ5a

const { config } = require("dotenv");
const client = new Client({
    disableEveryone: true
})
client.commands = new Collection();
client.aliases = new Collection();
config({
    path: __dirname + "/.env"
});
["command"].forEach(handler => {
    require(`./handlers/${handler}`)(client);
});

client.on("ready", () => {
    console.log(`Hi, ${client.user.username} is now online!`);
    client.user.setPresence({
        status: "online",
        game: {
            name: "FINAL FANTASY XIV",
            type: "Playing"
        }
    }); 
})
client.on("message", async message => {
    const prefix = "!";
    if (message.author.bot) return;
    if (!message.guild) return;
    if (!message.content.startsWith(prefix)) return;    
    if (!message.member) message.member = await message.guild.fetchMember(message);
    const args = message.content.slice(prefix.length).trim().split(/ +/g);
    const cmd = args.shift().toLowerCase();    
    if (cmd.length === 0) return;
    let command = client.commands.get(cmd);
    if (!command) command = client.commands.get(client.aliases.get(cmd));
    if (command) 
        command.run(client, message, args);
const events = {
    MESSAGE_REACTION_ADD: 'messageReactionAdd',
    MESSAGE_REACTION_REMOVE: 'messageReactionRemove',
};
client.on('raw', async event => {
    if (!events.hasOwnProperty(event.t)) return;
    const { d: data } = event;
    const user = client.users.get(data.user_id);
    const channel = client.channels.get(data.channel_id) || await user.createDM();
    if (channel.messages.has(data.message_id)) return;
    const message = await channel.fetchMessage(data.message_id);
    const emojiKey = (data.emoji.id) ? `${data.emoji.name}:${data.emoji.id}` : data.emoji.name;
    const reaction = message.reactions.get(emojiKey);

    client.emit(events[event.t], reaction, user);
});
client.on('messageReactionAdd', (reaction, user) => {
    message.author.send(`${user.username} reacted with "${reaction.emoji.name}".`);
});
client.on('messageReactionRemove', (reaction, user) => {
    message.author.send(`${user.username} removed their "${reaction.emoji.name}" reaction.`);
});
});
client.login(process.env.TOKEN);```

0 个答案:

没有答案