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

179
Vistas
Message content must be a non-empty string when editing message

I wanted to make a command to make the bot return its connection status to the database, but I got an error and I am a little confused now.

RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string.
const { MessageEmbed } = require('discord.js');
const quick = require('quick.db');

module.exports = {
  name: 'ping',
  aliases: [],
  description: 'Get bot ping.',
  permissions: [],
  async execute(message, client) {
    const ping = await getDBPingData();
    const messagePing = Date.now();
    const msg = await message.channel.send('Loading...');
    const endMessagePing = Date.now() - messagePing;

    const embed = new MessageEmbed()
      .setDescription(
        `
        Database ping data:
        - Fetch ping: \`${ping.endGet}ms\`
        - Wright ping: \`${ping.endWright}ms\`
        - Avrage ping: \`${ping.avarage}ms\`
        Message ping: \`${endMessagePing}ms\`
      `
      )
      .setColor('GREEN')
      .setTimestamp();

    msg.edit({
      content: '',
      embed,
    });
  },
};

async function getDBPingData() {
  // get the fetch data ping
  const startGet = Date.now();
  await quick.get('QR=.');
  const endGet = Date.now() - startGet;

  // get the wright data ping
  const startWright = Date.now();
  await quick.set('QR=.', Buffer.from(startWright.toString()).toString('base64'));
  const endWright = Date.now() - startWright;

  // avrage ping time
  const avarage = (endGet + endWright) / 2;
  try {
    quick.delete('QR=.'); 
  } catch (error) {}
  return { endGet, endWright, avarage };
}

I am using discord.js v13, and the packages in use for this command are: discord.js and quick.db.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Try this:

    // only need to edit embed in an embeds array
    msg.edit({ embeds: [embed] })
about 4 years ago · Juan Pablo Isaza Denunciar

0

In v13, messages sent by bots now support up to 10 embeds. As a result, the embed option was removed and replaced with an embeds array, which must be in the options object, so your message edit should be msg.edit({ embeds: [embed] }).

If you also want to remove the previous text (Loading...), you need to add content: null as providing an empty string ('') as the content will throw a RangeError.

msg.edit({
  content: null,
  embeds: [embed],
});
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