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

262
Vistas
all the embeds in my code stopped working + mute command error

first issue: all the embeds in my code stopped working - no matter what command I try to run if it has an embed in it I get the error: DiscordAPIError: Cannot send an empty message

second issue: I'm currently programming a mute command with a mongoDB database, it puts everything I need it in the database however if I try to mute someone it ends up only muting them for 1s by default, basically completely ignoring the second argument. heres what I want the command to do: when you mute someone you need to provide the user id and a time (works in ms) + reason then it puts it in the data base. here's the code: [P.S. Im not getting an error message, it just doesnt work properly like I want it to]

const mongo = require('../mongo.js')
const muteSchema = require('../schemas/mute-schema.js')
const Discord = require('discord.js')
const ms = require ("ms")

module.exports = {
  commands: 'mute',
  minArgs: 2,
  expectedArgs: "<Target user's @> <time> <reason>",
  requiredRoles: ['Staff'],
  callback: async (message, arguments) => {
    const target = message.mentions.users.first() || message.guild.members.cache.get(arguments[0])
    if (!target) {
      message.channel.send('Please specify someone to mute.')
      return
    }
    const { guild, channel } = message
    arguments.shift()
    const mutedRole = message.guild.roles.cache.find(role => role.name === 'muted');
    const guildId = message.guild.id
    const userId = target.id
    const reason = arguments.join(' ')
    const user = target
    const arg2=arguments[2]
    const mute = {
      author: message.member.user.tag,
      timestamp: new Date().getTime(),
      reason,

    }

    await mongo().then(async (mongoose) => {
      try {
        await muteSchema.findOneAndUpdate(
          {
            guildId,
            userId,
          },
          {
            guildId,
            userId,
            $push: {
              mutes: mute,
            },
          },
          {
            upsert: true,
          }
        )
      } finally {
        mongoose.connection.close()
      }
    })
    message.delete()
    user.roles.add(mutedRole)
    setTimeout(function() {
        user.roles.remove(mutedRole)
    }, ms(`${arg2}`));
    try{
        message.channel.send(`works`)
    }
    catch(error){
      const embed3 = new Discord.MessageEmbed()
      .setDescription(`✅ I Couldn't DM them but **${target} has been muted || ${reason}**`)
      .setColor('#004d00')
      message.channel.send({ embeds: [embed3] });
    }
  },
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

djs v13 has a new update where you need to send embeds like this:

const exampleEmbed = new Discord.MessageEmbed()
.setTitle('example')
.setDescription('example')
.setColor('RANDOM')
 message.channel.send({embed: [exampleEmbed]});
about 4 years ago · Juan Pablo Isaza Denunciar
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