mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
feat(Message): Add method to resolve a component by id (#6484)
This commit is contained in:
@@ -817,6 +817,15 @@ class Message extends Base {
|
||||
return this.edit({ attachments: [] });
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a component by a custom id.
|
||||
* @param {string} customId The custom id to resolve against
|
||||
* @returns {?MessageActionRowComponent}
|
||||
*/
|
||||
resolveComponent(customId) {
|
||||
return this.components.flatMap(row => row.components).find(component => component.customId === customId) ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used mainly internally. Whether two messages are identical in properties. If you want to compare messages
|
||||
* without checking all the properties, use `message.id === message2.id`, which is much more efficient. This
|
||||
|
||||
Reference in New Issue
Block a user