Reputation: 15
I'm trying to make my bot react on the message which has its username
If I enter my bot username like this, it works:
if(message.content.includes('bot123')) console.log('TRUE') //TRUE
But this one doesn't:
if(message.content.includes(client.user.username)) console.log('TRUE') //doesn't work
I wonder why and if there is a way to make client.user.username works
Upvotes: 0
Views: 73
Reputation: 28
In the messageCreate event the only parameter is message, thus if you are using a lets say command handler it would be
if(message.content.includes(message.client.user.username)) // ...
Upvotes: 1