![](/img/trans.png)
[英]How do I make it so when a user tags the discord bot, it responds with a message?
[英]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”)您正在回复其消息的用户。 你只需要设置allowedMentions
为repliedUser
为false
:
reaction.message.reply({
content: 'Your message here',
allowedMentions: {
repliedUser: false
}
} as ReplyMessageOptions);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.