Reputation:
I have two errors on this code
The first error is Argument expression expected in last }. The second error is Declaration or statement expected in the last ). It can be the unfinished { and ( but I can't find an unfinished one.
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
const args = message.content.slice(config.prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'ping') {
message.channel.send('Pong.');
} else if (command === 'help') {
message.channel.send({ embed: {
color: 16758465,
title: "You want help?",
description: ":sparkles:Hi! I'm Ohi bot owned by ilkoshu.",
fields: [{
name: ":fish_cake:Bot Commands",
value: "..commands"
},
{
name: ":strawberry:Contact Me",
value: "..contact"
},
],
timestamp: new Date(),
}
});
}
else if(command === "commands"){
message.channel.send({ embed: {
color: 16758465,
title: "Bot Commands",
fields: [{
name: ":birthday:Fun Commands",
value: "..dice, ..avatar, ..meme, ..say, ..animesuggest, ..top15animech, ..guessage"
},
{
name: ":mushroom:Roleplay Commands",
value: "..hug [user], ..pat [user], ..kiss [user], ..cuddle [user], ..greet [user], ..bite [user], ..slap [user], ..punch [user], ..kill [user], ..run, ..cry, ..smile, ..dance"
},
{
name: ":shaved_ice:Admin Commands",
value: "..ban [user], ..kick [user], ..voicemute [user], ..clear [2-20], ..serverinfo"
},
{
name: ":chocolate_bar:About Bot",
value: "..ping, ..botinfo, ..vote, ..invite"
}],
},
},
//...
});
Upvotes: 0
Views: 3288
Reputation: 171
The error that you were having was due to the commas ,
and the parenthesis )
misplaced. First of all, you shouldn't be placing commas to close functions, unless you are calling a new one after. You were not closing in any parenthesis for this line message.channel.send({ embed: {
, which was causing 1 error. The other error was due to the comma present on the first line of the following example:
},
//...
});
After removing the commas and placing the parenthesis on the right line, your code will end up being the following:
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
const args = message.content.slice(config.prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'ping') {
message.channel.send('Pong.');
} else if (command === 'help') {
message.channel.send({ embed: {
color: 16758465,
title: "You want help?",
description: ":sparkles:Hi! I'm Ohi bot owned by ilkoshu.",
fields: [{
name: ":fish_cake:Bot Commands",
value: "..commands"
},
{
name: ":strawberry:Contact Me",
value: "..contact"
},
],
timestamp: new Date(),
}
});
}
else if(command === "commands"){
message.channel.send({ embed: {
color: 16758465,
title: "Bot Commands",
fields: [{
name: ":birthday:Fun Commands",
value: "..dice, ..avatar, ..meme, ..say, ..animesuggest, ..top15animech, ..guessage"
},
{
name: ":mushroom:Roleplay Commands",
value: "..hug [user], ..pat [user], ..kiss [user], ..cuddle [user], ..greet [user], ..bite [user], ..slap [user], ..punch [user], ..kill [user], ..run, ..cry, ..smile, ..dance"
},
{
name: ":shaved_ice:Admin Commands",
value: "..ban [user], ..kick [user], ..voicemute [user], ..clear [2-20], ..serverinfo"
},
{
name: ":chocolate_bar:About Bot",
value: "..ping, ..botinfo, ..vote, ..invite"
}]
}
})
}
I hope it helped, and best of luck with your coding!
Upvotes: 1