I'm trying to add a listener for whenever my discord bot sends an embed with a specific title, however I'm not sure how to collect or listen for that event.
I'd like to listen for when my discord bot sends an embed with a title of 'Success'. Is there a way to listen for embeds sent from my discord bot?
It would also work if I could listen for when my discord bot sends a plain text message to a channel, just need a way to listen and do something after it collects that message.
As per the docs , awaitMessages
is a type of MessageCollector
interaction.channel.awaitMessages({ max: 1, time: 30000, errors: ['time'] })
.then(collected => {
if (collected.hasOwnProperty('title')) {
if (collected.title === 'Success!') interaction.followUp('Detected.')
};
})
.catch(collected => {
interaction.followUp('No messages collected in the time limit.');
});
Since the embed will have property title, check for that property then if the title matches return success.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.