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

266
Vistas
[EMBED_DESCRIPTION]: MessageEmbed description must be a string

This is my code and im getting this error: RangeError [EMBED_DESCRIPTION]: MessageEmbed description must be a string can can someone help me please? i want to make leaderboard

const { MessageEmbed } = require("discord.js");
const Discord = require('discord.js');
const Database = require("@replit/database");
const db = new Database();

module.exports = {
  name: "Leaderboard",
  aliases: ['leader', 'leaderboard', 'топ', 'Топ'],
  run: async (client, message, args) => {
    const collection = new Collection();

    await Promise.all(
      message.guild.members.cache.map(async (member) => {
        const id = member.id;
        const bal = await db.get(`balance_${id}`);

        console.log(`${member.user.tag} -> ${bal}`);
        return bal !== 0
          ? collection.set(id, {
              id,
              bal,
            })
          : null;
      })
    );

    const data = collection.sort((a, b) => b.bal - a.bal).first(10);

    message.channel.send(
      new MessageEmbed()
        .setTitle(`Leaderboard in ${message.guild.name}`)
        .setDescription(
          data.map((v, i) => {
            return `${i + 1}) ${client.users.cache.get(v.id).tag} => **${v.bal} coins**`;
          })
        )
    );
  },
};```
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In setDescription you're calling data.map(...) which returns an array. You can use Array.prototype.join to create a string from the array elements: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join

data.map(...).join('\n')

If your array looked like this ['abc', 'def', 'ghi'] then the output of the join would be a string that looks like this:

abc
def
ghi
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