javascript - How do I make my bot not mention users when it responds? - Stack Overflow

I'm trying to get my bot to reply to a specific mand, but I don't want him to mention the use

I'm trying to get my bot to reply to a specific mand, but I don't want him to mention the user who uses the mand 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`);
    }
  });

I'm trying to get my bot to reply to a specific mand, but I don't want him to mention the user who uses the mand 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`);
    }
  });
Share Improve this question edited Aug 14, 2019 at 19:25 Mikhail Zhuikov 1,2582 gold badges9 silver badges23 bronze badges asked Aug 14, 2019 at 18:39 swizzlesticksswizzlesticks 391 silver badge2 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

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);

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'); 
    } 
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742311316a4419949.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信