making sure embed title is correct

im trying to get it so that the command works for things with "Card View" as the title in the embed, so no other embed except those would work. how can i do so?
client.on("message", () => {
if(message.embeds[0].title === 'Card View'){
console.log('this is working')
}
});
client.on("message", () => {
if(message.embeds[0].title === 'Card View'){
console.log('this is working')
}
});
p.s i have no clue what im doing and just going off tutorials but none are working. the issue that its having right now is not that theres any errors or anything, its just not sending the console log which means something is going on wrong. most likely the equal signs but still i am confused. also not sure if the client on thing works either.
5 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
treble/luna
treble/luna6mo ago
first of all the event name is messageCreate second of all, not all messages have embeds, so that would error use optional chaining third, an embed has a data property, which holds stuff like title etc
smirkymyjens
smirkymyjens6mo ago
how would i check for if a message has an embed?
treble/luna
treble/luna6mo ago
check if embeds isnt an empty array
smirkymyjens
smirkymyjens6mo ago
ok thank