After noticing that deviantArt embeds on discord were really bad, I decided to make a feature in my bot that would detect a deviantart url with an event and send a better embed that worked.
If there is several urls in the message, it detects DeviantArt ones and sends embeds of them (bot).
My issue is that sometimes, in the same message (user), some DA urls embed show and some don't. So I want to delete only Deviantart embeds to keep ArtStation ones.
But the only thing I found on Discord js is message.suppressEmbeds(true)which delete all embeds of a message.
I tried using message.edit() but it is unauthorised for non-authors of the message.
I also tried looping through all embeds and storing in an array all urls not being DeviantArt. So i could re-send them after running message.suppressEmbeds(true) but the re-sent version looks somehow different. And I still can't figure out why
var messageEmbed = [];
var index = 0;
for(var embed of msg.embeds){
if(!embed.url.includes("www.deviantart.com")){
messageEmbed[index] = new Discord.MessageEmbed(embed);
//also tried with
//messageEmbed[index] = embed; it does the same thing
index++;
}
}
I need either:
- to find a way do delete specific embed of a message (user).
- to find a way to display properly the stored embed.