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

125
Views
TypeError: message.author is not a function

For this piece of code, I aim for the author of the message that sent the ban command to be checked for whether they have the permissions necessary to ban the member, instead of instantly being allowed to, however I am unsure of what the const mod should be equivalent to to do so. Any help would be appreciated, thanks.

module.exports = {
    name: 'ban',
    description: "This command ban a member!",
    execute(message, args) {
        const target = message.mentions.users.first();
        const mod = message.author();
        
        if (mod.hasPermission('BAN_MEMBERS')) {
            if (target) {
                const memberTarget = message.guild.members.cache.get(target.id);
                memberTarget.ban();
                message.channel.send("User has been banned");
                
            }
            
            
        } else if (mod.hasPermission(!'BAN_MEMBERS')) {
            message.channel.send(`You couldn't ban that member either because they don't exist or because you dont have the required roles!`);
        }
    }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As it says, Message.author is not a function. It is a property. You access it without the brackets

const mod = message.author

Another problem you may get is you can't get permissions. You will need Message.member for that

const mod = message.member
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!