Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
Declaration Or Statment expected Javascript/Discord.js

So Im coding in javascript a discord bot and then what happens is i get an Declaration Or Statment expected error even if its not needed

const client = new Discord.Client({ intents: 32767 });

client.on("ready", () => {
    console.log("✔✔ online")
})

client.on("messageCreate", message => {
    const prefix = ">"
    if(!message.content.startsWith(prefix)) return;

    const messageArray = message.content.split(" ");
    const cmd = messageArray[0];
    const args = messageArray.slice(1);



    if (message.content === `${prefix}test`) {
        message.reply("Working")
    }

    if (cmd == `${prefix}kick`) {
        if(!args[0]) return message.reply("Please Mention Someone or Put That Persons ID or Put That Persons Username to Kick The User Out Of The Server!");
        const member = (message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(x => x.user.username.toLowerCase() === args.slice.join(" ") || x.user.username === args[0]));
        if(!message.member.permissions.has("KICK_MEMBERS")) return message.reply("Since When You Have a kick members perm" || "You need to have the kick permission perm to use this command");
});

client.login("not showing token ");```
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have a wrong synatax. Your code should be

const client = new Discord.Client({ intents: 32767 });

client.on("ready", () => {
    console.log("✔✔ online")
})

client.on("messageCreate", message => {
    const prefix = ">"
    if(!message.content.startsWith(prefix)) return;

    const messageArray = message.content.split(" ");
    const cmd = messageArray[0];
    const args = messageArray.slice(1);



    if (message.content === `${prefix}test`) {
        message.reply("Working")
    }

    if (cmd == `${prefix}kick`) {
        if(!args[0]) return message.reply("Please Mention Someone or Put That Persons ID or Put That Persons Username to Kick The User Out Of The Server!");
        const member = (message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(x => x.user.username.toLowerCase() === args.slice.join(" ") || x.user.username === args[0]));
        if(!message.member.permissions.has("KICK_MEMBERS")) return message.reply("Since When You Have a kick members perm" || "You need to have the kick permission perm to use this command");
};
});

client.login("not showing token ");
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!