Wait until link or image embeds appears on message
On a
messageCreate
event, a message with a link that contains an embed does not have the embed data with it (as Discord hasn't resolved it yet). As soon as Discord resolves it (0.5-2 seconds), a messageUpdate
event fires and the new message contains the embed data. Does DiscordJS have anything built in to await this embed update with a collector? I want an API similar to <Interaction>.awaitModalSubmit
or <Message>.awaitReactions
.5 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.I couldn't find anything in the docs but maybe I'm missing something, that's why I am asking
Seems like many people would want something like this. How is this typically implemented? Create a collector manually and await it?
Ah I found the discussion I think
GitHub
Add Message#awaitEmbeds method to get URL embeds in a message · Iss...
Feature I would like to suggest the creation of a Message#awaitEmbeds method. This method can only be used for messages received in the messageCreate and messageUpdate (in case of content changes) ...
I guess if I was to manually implement it, I would check if it was a link and provide a reasonable timeout
Maybe one could do something hacky with actually making a request to the URL and check the meta tags but that seems excessive
Tricky tricky
I think I will just do something stupid:
If message contains any link, wait for like, 2 seconds, then fetch the message again.
If anyone has any better ideas let me know :) And thanks for the pointer that it's been discussed before
Posted my solution in the issue:
https://github.com/discordjs/discord.js/issues/7053#issuecomment-1215938212
GitHub
Add Message#awaitEmbeds method to get URL embeds in a message · Iss...
Feature I would like to suggest the creation of a Message#awaitEmbeds method. This method can only be used for messages received in the messageCreate and messageUpdate (in case of content changes) ...