#Deleting embeds by its content

32 messages · Page 1 of 1 (latest)

trim mortar
#

Hi, is it possible for bots to read the content of an embed, and remove embedded message, when they have something in it? For example, i want to remove every embed, that have "[Wideo]" in it

vagrant heronBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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!
  • Marked as resolved by OP
hushed sail
#

does your bot send it?

trim mortar
#

no

glass vortex
#

does your bot have MessageContent intent?

#

if yes then that's possible

trim mortar
#

ye, it have

exotic sandalBOT
glass vortex
#

do you want to suppress the embeds or delete the full message?

trim mortar
#

probably delete

glass vortex
#

great. need any more information to do it?

trim mortar
#

yeah, will it use normal Event.MessageCreate to detect message with the embed or how it will look?

#

because of i have no idea how the intents works

onyx condor
#

so just check the author, if it's the one you're looking for

#

and do the rest of the code

glass vortex
#

if you have GuildMessages intent that is

#

else it won't emit

trim mortar
#

okay, could someone show me how to... idk. detect the text that is in embed?

onyx condor
trim mortar
#

i have the

client.on(Events.MessageCreate, async interaction => {
})

and what should be in it, and sorry, because i have no idea how i should use that intent in my code

glass vortex
#

why do you name the Message you receive there interaction?

#

please refer to the docs for properties and their types

exotic sandalBOT
trim mortar
#

does it matter?

glass vortex
#
  • the name: yes, so you (and helpers trying to help you) won't get confused by it in the future
  • the docs: yes, so you know what to write
trim mortar
#

okay, so i renamed it to just "message", and now for example i just want to console.log the message of embed sent, how do i do it? because if i do console.log(message) theres only info, that embed exists

trim mortar
#

i mean i saw that, but i have no idea how to read that xD i mean idk if i should press something to go to any example how to use it or what

glass vortex
#

your message variable is of type Message (as seen in the second doc sent). Those have a property named embeds (first docs) of type Embed[]. So message.embeds[0] for example would be an Embed (or undefined if there are none on that message)

#

clicking on Embed on that doc page would tell you what properties that has

#

and so on