My bot sends the message if someone boosts/unboosts the server.
You can see my code here:
client.on("guildMemberUpdate", (oldMember, newMember) => {
const oldStatus = oldMember.premiumSince;
const newStatus = newMember.premiumSince;
if (!oldStatus && newStatus) {
client.channels.cache
.get("channel id")
.send(`Thank you ${newMember.user.tag} (:`);
}
if (oldStatus && !newStatus) {
client.channels.cache
.get("channel id")
.send(`woah ${newMember.user.tag}, unboost this server`);
}
});
The code works perfectly, there is no error, but the bot is not tagging people, just mentioning the tag name like this:
I want the bot to mention people like this instead:
I think the problem is ${newMember.user.tag}. Usually, I use <@${member.id}>, but I don't know how to fix this code if using {user.tag}.
You can either use:
.send(`woah <@${newMember.id}>, unboost this server`)
or simply:
.send(`woah ${newMember}, unboost this server`)