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

176
Views
Discord.JS token ban function not working properly when trying to run the command in terminal

Ok so i was trying to create a discord bot, with ban commands but then this happened

https://i.stack.imgur.com/ogAHf.png

Here is my code

https://i.stack.imgur.com/5ceGo.png

How do i fix this?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It should be:

module.exports = {
    name: 'ban',
    description: "This command bans people",
    execute(message, args) {

        if(message.member.roles.cache.has('923203237019004958')) {
            const member = message.mentions.members.first();
            if(member) {
                const memberTarger = message.guild.members.cache.get(member.id);
                memberTarger.ban();
                message.channel.send("User has been banned from the paper bag");
            }
            else {
                message.channel.send("You don't have the sufficent permissions to run this command")
            }
        }

    }
}

There was a closing bracket } next to the execute(message, args) but it should be an opening bracket {

about 4 years ago · Santiago Trujillo 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!