Reputation: 187
I'm trying to make a discord bot to filter out bad words, but the problem is that I only can have 1 method after Message.content
in which case I got .toLowerCase
but I also want to make it so that it reads the word wherever in the sentence it was used, only important stuff I got right now
client.on('message', message => {
if (message.content.toLowerCase() === 'hello')
message.channel.send('yoyo ' + '<@' + message.author + '>');
});
Upvotes: 0
Views: 73
Reputation: 36
If i understood correctly, is this what you would be looking for? This allows you to look for lowercase letters anywhere in your sentence.
client.on('message', message => {
if (message.content.toLowerCase().includes('hello'))
message.channel.send('yoyo ' + '<@' + message.author + '>');
});
Upvotes: 2