Greetings, I am encountering an issue expressed by the error message: if (typeof data !== 'string') throw new error(errorMessage); RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.
I am attempting to display the number of players on a Minecraft server as follows:
Players Online: 79 Players
This is what my current code looks like:
let state = null;
let players = 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],
});
}
},
);