Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda