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

222
Visualizações
Discord.js check warnings command bug
const Mongodb = require('../../models/modSchema');
const Discord = require('discord.js');

module.exports = {
    name: 'warnings',
    category: "moderation",
    description: 'Finds and displays the warnings of the mentioned user.',
    run : async(client, message, args, db) => {
        const mentionedMember = message.mentions.members.first() || message.guild.members.cache.get(args[0]);

        if(!mentionedMember) return message.channel.send("bruh mention a member u nub");

        Mongodb.find({ guildId : message.guild.id, userId : mentionedMember.user.id}, async(err, data) => {
            if(err) throw err;
            if(data) {
                message.channel.send(new Discord.MessageEmbed()
                    .setTitle(`${mentionedMember.user.tag}'s punishments.`)
                    .addFields(
                        data.map((warn)=> {
                            if (!warn || warn === undefined) return { name: 'Punishments', value: 'This user has no punishments' };
                            if (warn) return { name: `Case #${warn.case} - ${warn.punishType}`, value: warn.reason};
                        })
                    )
                    .setColor("GREEN")
                )
            } 
        });
    }
}

This is my code. Whenever I type -warnings user and the user has no warns then it replies with user's warn when it's supposed to reply with This user has no warnings. Another question I have is how to make the bot show the user's warnings when the user says -warnings it shows the current user's warnings meaning that the user that said -warnings.

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