Function to get Component Data by ID

I saw that there is a way to pass a numeric ID to a message component, which serves as an identifier to recognize an element, is it possible to get it with some function? That already exists of course or do I need to implement it if I need it?
6 Replies
d.js toolkit
d.js toolkit3mo ago
monbrey
monbrey3mo ago
There is no existing function for this You would filter recursively through message.components to find items by ID
Quir
QuirOP3mo ago
Thx If I create it, do you think it would be valid to create a PR or method within interaction.message.components.GetComponentbyID(ID) or does this end up being something extremely specific that is rarely used?
monbrey
monbrey3mo ago
We would not want to support that helper method, no And message.components is just an array, not a custom class
achootumor
achootumor3w ago
hate to bump, but is there really no way to get a particular component from a message, especially with componentsV2, without recursively filtering or manually accessing by index?? closest i could get was Message#resolveComponent() which works only with v1 components i'm led to believe
Amgelo
Amgelo3w ago
there isn't though it's pretty much just a one level recursion for containers then it's a different case and handling for each component

Did you find this page helpful?