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

97
Vistas
cant use variables from gamedig onembed

im working on a status bot but can't use variables from the game state in my embed, its not showing when im try to put it on the description

here it's my code I edited the code

The whole code is like this


const Discord = require("discord.js");
const yaml = require("js-yaml");
const Gamedig = require('gamedig');
const supportbot = yaml.load(
  fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));

const Command = require("../Structures/Command.js");
const { timeStamp } = require("console");
var request = require('request');


const jugadores = state.players.length;


setInterval(() => {
  // query your game server
  Gamedig.query({
    type: 'minecraft',
    host: 'mc.latinplay.net',
    port: '25565'
  })
  .then((updatedState) => {
    state = updatedState;
  });
}, 6000); 



let state = null;


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


  async run(interaction) {



      const LatinEstado = new Discord.MessageEmbed() 
    .setColor('RANDOM') ```
    .setDescription("Users:", jugadores) 

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

0

The state variable has to be declared before you use it. The jugadores variable cannot be const if you want it to change.

let state = null;

let jugadores = 0;

setInterval(() => {
  // query your game server
  Gamedig.query({
    type: 'minecraft',
    host: 'mc.latinplay.net',
    port: '25565'
  })
  .then((updatedState) => {
    state = updatedState;
    jugadores = state.players.length;
  });
}, 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