我正在尝试创建一个机器人来过滤不和谐的单词 当我使用函数include时,出现错误提示我:无法读取未定义的属性'includes
我不明白我的问题在哪里
预先感谢
var Discord = require('discord.io');
var logger = require('winston');
var auth = require('./auth.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console, {
colorize: true
});
logger.level = 'debug';
// Initialize Discord Bot
var bot = new Discord.Client({
token: auth.token,
autorun: true
});
bot.on('ready', function (evt) {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(bot.username + ' - (' + bot.id + ')');
});
bot.on('message', message => {
const swearWords = ["heck", "damn","darn"];
if( swearWords.some(word => message.content.includes(word)) ) {
message.delete();
message.author.send('Hey! That word has been banned, please don\'t use it!');
}
})