繁体   English   中英

如何让我的机器人在响应时不提及用户?

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

我正在尝试让我的机器人回复特定命令,但我不希望他在使用该命令回复预加载响应时提及使用该命令的用户。 有人可以帮忙吗?

我认为这可能是由于代码“msg.reply”造成的,但我不确定如何编辑它以确保他没有提到用户。

谢谢!

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

而不是执行message.reply而是执行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 年更新:使用新的回复功能,可以避免提及(“ping”)您正在回复其消息的用户。 你只需要设置allowedMentionsrepliedUserfalse

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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