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

265
Vistas
MessageEmbed field values must be non-empty strings gamedig problem

Hello i have a problem and its its if (typeof data !== 'string') throw new error(errorMessage); RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.

i trying on players to put the amount of players that the minecraft server has like:

Players Online: 79 Players

my code its:


let state = null;

let jugadores = 0;

setInterval(() => {


  Gamedig.query({
    type: 'minecraft',
    host: 'mc.latinplay.net',
    port: '25565'
  })
  .then((updatedState) => {
    state = updatedState;
    players = state.players.length;
  });
}, 6000);

module.exports = new Command({
  name: cmdconfig.EstadoCommand,
  description: cmdconfig.EstadoCommandDesc,


  async run(interaction) {

      const LatinStatus = new Discord.MessageEmbed() 
    .setColor('RANDOM') 
       .addField('**Players:**', 'players')
      .addField('**Status**', "**Online💚**", true);
      interaction.reply({
        embeds: [LatinEstado],
      });
  
    }
  },
);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Modify your code from your recent:

let state = null;

let jugadores = 0;

setInterval(() => {


  Gamedig.query({
    type: 'minecraft',
    host: 'mc.latinplay.net',
    port: '25565'
  })
  .then((updatedState) => {
    state = updatedState;
    players = state.players.length || "0"; //adding || operator so no error will occure
  });
}, 6000);

module.exports = new Command({
  name: cmdconfig.EstadoCommand,
  description: cmdconfig.EstadoCommandDesc,


  async run(interaction) {

      const LatinStatus = new Discord.MessageEmbed() 
    .setColor('RANDOM') 
       .addField('**Players:**', 'players')
      .addField('**Status**', "**Online💚**", true);
      interaction.reply({
        embeds: [LatinEstado],
      });
  
    }
  },
);

Ive seen alot of errors in here, you can also use an operator called or in operator || to prevent error when players reached on 0 members.

module.exports = new Command({
  name: cmdconfig.EstadoCommand,
  description: cmdconfig.EstadoCommandDesc,


async run(interaction) {
let state = null;

let jugadores = 0; //I also don't understand what is these for.

setInterval(() => {
  Gamedig.query({
    type: 'minecraft',
    host: 'mc.latinplay.net',
    port: '25565'
  })
  .then((updatedState) => {
     state = updatedState;
     players = state.players.length;
     const LatinStatus = new Discord.MessageEmbed() 
    .setColor('RANDOM') 
    .addField('**Players:**', `${players}`) //also it must be `${players}`
    .addField('**Status**', "**Online💚**", true);
    interaction.reply({
      embeds: [LatinEstado],
    });
  });
}, 6000);
    }
  },
);

EDIT:

I tried your code and caught an error such as Error: Failed all 1 attempts

so you can use .catch function

setInterval(() => {
  Gamedig.query({
    type: 'minecraft',
    host: 'mc.latinplay.net',
    port: '25565'
  }).catch((err) => {
     console.log() //or
     console.log(err)
  })
  .then((updatedState) => {
     state = updatedState;
     players = state.players.length;
     const LatinStatus = new Discord.MessageEmbed() 
    .setColor('RANDOM') 
    .addField('**Players:**', `${players || "0"}`) //also it must be `${players}`
    .addField('**Status**', "**Online💚**", true);
    interaction.reply({
      embeds: [LatinEstado],
    });
  });
}, 6000);
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