简体   繁体   中英

How do I make my bot not mention users when it responds?

I'm trying to get my bot to reply to a specific command, but I don't want him to mention the user who uses the command when he replies with his pre-loaded response. Could anyone help?

I think it may be due to the code 'msg.reply' but I'm not sure how to edit it to ensure that he doesn't mention the user.

Thanks!

 client.on('message', msg => {
    if (msg.content === '!events') {
      msg.reply(`Birthday party - September 14th
Christening - October 18th
Halloween - October 31st`);
    }
  });

Instead of doing message.reply do message.channel.send

client.on('message', msg => { 
    if (msg.content === '!events') {
        msg.channel.send('Birthday party - September 14th Christening - October 18th Halloween - October 31st'); 
    } 
});

2021 update: With the new reply feature, it is possible to avoid mentioning ("pinging") the users whose message you are replying to. You just have to set the allowedMentions for repliedUser to false :

reaction.message.reply({
    content: 'Your message here',
    allowedMentions: {
        repliedUser: false
    }
} as ReplyMessageOptions);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM