Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda