Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
RangeError [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?

const db = require('../models/warns')
const Command = require("../stractures/command");
const Discord = require('discord.js')

module.exports = new Command({
    name: "warns",
    aliases: [""],
    description: "Clear messages",
    async run(message, args, client) {
        const user = message.mentions.members.first() || message.guild.members.cache.get(args[0])
        if (!user) return message.channel.send('User not found.')
        const reason = args.slice(1).join(" ")
        db.findOne({
            guildid: message.guild.id,
            user: user.user.id
        }, async (err, data) => {
            if (err) throw err;
            if (data) {
                const embed = new Discord.MessageEmbed()
                embed.setTitle(`${user.user.tag}'s warns`)
                .setDescription(data.content.map((w, i) =>`\`${i + 1}\` | Moderator : ${message.guild.members.cache.get(w.moderator).user.tag}\nReason : ${w.reason}`))
                    .setColor("BLUE")
                message.channel.send({
                    embeds: [embed]
                })
            } else {
                message.channel.send('User has no data')
            }

        })
    }
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It’s simply because you are sending an array, rather than a string. Simply joining the array will work

.setDescription(data.content.map((w, i) =>`\`${i + 1}\` | Moderator : ${message.guild.members.cache.get(w.moderator).user.tag}\nReason : ${w.reason}`).join("\n"))
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!