I want that when writing an email, the member is given a role in discord. But since I don't know how to do it, I tried this, the issue is that if (message.content === "@"){
only works when I put @
, I want it to include @
, I couldn't do it with If @ in message.content
, nor with neither message.content.startswith
nor contains
FULL CODE
const Discord = require("discord.js");
const client = new Discord.Client();
const mySecret = process.env['token']
client.on("ready", () => {
console.log("ready");
});
client.on("message", message => {
if(message.channel.id === "963510775215968266"){
if(message.author.bot) return;
if (message.content === "@"){
message.member.roles.add("963515178174021642");
message.author.send("Gracias por verificarte");
message.delete();
}
else{
message.author.send("¿Tienes problemas? Comunicate con un staff.");
message.delete();
}
}
});
client.login(mySecret);
If someone can give me a hand I would really appreciate it, I've been reading different pages for hours and I can't find the solution, or I just don't know how to apply it well