Reputation: 33
I am a beginner at Node.js Coding and recently coded my bot on repl.it I know that there is something wrong with this code and cannot understand where should I put '{' Can you please help me <3 Here is my code:
client.on("message", async (message) => {
if(message.content.startsWith("!warn"))
let victim = message.mentions.users.first()
if(!victim) message.reply("mention someone to warn.")
else {
let embed = new Discord.MessageEmbed()
.setTitle("Warnings")
.setDescription(`${victim} got warned by ${message.author}!`)
.setColor("GREEN")
.setFooter(`Moderator : ${message.author.username}`)
.setTimestamp()
message.channel.send(embed)
}
});
If there are some questions ask it I will really appreciate it if you will help! <3
Can you please send the final version of this code
Upvotes: 0
Views: 1261
Reputation: 123
You missed brackets on your opening check for message.content
and as a user suggested, try learn some basic JS before coding. I know making a discord bot you want to go straight into in but spend maybe an hour learning the very basics can solve alot of issues for you. :)
client.on("message", async (message) => {
if (message.content.startsWith("!warn")) {
let victim = message.mentions.users.first();
if (!victim) return message.reply("mention someone to warn.");
let embed = new Discord.MessageEmbed()
.setTitle("Warnings")
.setDescription(`${victim} got warned by ${message.author}!`)
.setColor("GREEN")
.setFooter(`Moderator : ${message.author.username}`)
.setTimestamp();
message.channel.send(embed);
}
});
Upvotes: 1