if (msg.content === 'SWEARWORD') {
msg.reply('No swearing u nub >:) ');
}
如何修复它并使其自动删除脏话消息?
答案 0 :(得分:2)
您应该使用数组来存储您的单词并检查消息的内容是否包含它们:
const words = [ 'bread', 'apple', 'tea' ];
const forbiddenWord = words.some((word) => message.content.includes(word));
if (forbiddenWord ) {
message.delete();
message.channel.send('your message should not include : '+forbiddenWord);
}