how to detect an embed and then resend it
i want to do if the bot received the bot embed title call "wild pokémon has appeared!" then it will send message.
11 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.You could listen to
messageCreate
, check the embed property and then check if the title of the (first) embed matches.
(See KAVI's message below)<Message>.embeds
gives you access to the embed array. Check it's length to see if there are any embeds, if not ignore the message.
And by using <Message>.embeds[0].title
you can get the title of the first embed in that message.
Combine the two instructions
<:T_wink:940369475503530004>:D
so the code will be
?
Something like that yeah.
But remember. Like I said. The 0th index of the array could be null at some point.
It's good practice to check that before you check the title. But if you're certain that there will be an embed... then yes
My advice is to scope it to a channel
Rather than the whole messageCreate event
Or use optional chaining for that to prevent sudden errors (?.)
Oh yeah... that as well.. lmao forgot about that for a second there thanks
thanks man
thanks man
it worked
You’re welcome
Another happy coder.
Keep up the good work
<:nb_cat_pat:851511871664029707>