Search code examples
javascriptdiscord.jsembed

Mixed Embed Outputs Discord.js


So I've made a couple of commands on discord.js and I got interesting yet confusing results, the embed outputs are all messed up like if I do a clear command It clears the messages but the embed results are the same as my ping command I tried to check my code but nothing seemed wrong here it is, I apologize if it's messy I don't know how to type properly, although the weird thing is that the part where the embed mix-up originated is just like the others, here is the code

(embed)
        .setTitle('Bot Latency:')
            .setDescription(`${Date.now() - message.createdTimestamp} ms`)
            .addField('API Latency', `${Math.round(client.ws.ping)}ms`)
            .addField('Discord Status', `https://discordstatus.com/`)
            .setColor(0x008080)
        message.channel.send(embed);

Solution

  • You for sure have multiple embeds with the same variable. That can be the reason of the problem. Try giving every embed another name such as for a ping command

    const pingembed = new Discord.MessageEmbed()
    

    for a clear command

    const clearembed = new Discord.MessageEmbed()
    

    and doing so for all embeds.