Persik
Persik

Reputation: 275

Discord JS Embed not doing expected

I've recently came upon an issue with Discord JavaScript (Node) that fails to send the second embed. I've used Embed Visualizer and it does as expected. I think there's an issue with the code itself. Code below.

let t = ":x:"
if (message.guild.users.find("name", "Paralyss").roles.find("name", "Paralyss")){
    let t = ":heavy_check_mark:"
}
let v = ":x:"
if(Date.now() - message.createdTimestamp < 5000){
    let v = ":heavy_check_mark:"
}
let time = Date.now() - message.createdTimestamp
try {
    message.member.guilds.channels.find(`name`, `mod-logs`).send({embed: {
        "color": 4886754,
        "author": {
            "name": "Command Ran",
            "icon_url": message.author.avatarURL
        },
        "fields": [
            {
                "name": "Status:"
                "value": `:heavy_check_mark:**Command Status**\n:heavy_check_mark:**Mod Status**\n${v}**${time}**\n${t}**Administrator**`,
                 "inline": true
            },
            {
                "name": "Command ran:",
                "value": "%**uptime**,
                "inline" true
            },
            {
                "name": "Uptime in server:",
                "value": `${client.uptime / 1000}`,
                "inline": true
            }
        ]
    }});
} catch (error) {
    console.log(error);
}

Console does not print anything.

Upvotes: 0

Views: 157

Answers (1)

Federico Grandi
Federico Grandi

Reputation: 6816

I see that you're using message.member.guilds.channels.find() but GuildMember.guilds is wrong (it should be GuildMember.guild). Try using message.guild.channels.find() instead.

Upvotes: 1

Related Questions