Reputation: 49
So if people mention me, I want the bot to say "yo sup", I've used this code but the bot doesn't say anything I want the bot to say something back, I don't know what's wrong here
What should I fix in this code?
client.on("message", (message) => {
if (message.author.bot) return;
if (message.content.startsWith("<@myid> ")) {
message.channel.send('yo sup');
};
});
Upvotes: 1
Views: 174
Reputation: 9041
You can use Message#mentions
. Use the .users
property from Message#mentions
for this
if (message.mentions.users.has("your_id")) {
message.channel.send('yo sup');
}
Upvotes: 3