Change in ActionRow stuff

Feeling a bit stupid, what change in v14 is related to this being needed? row is an ActionRowBuilder, not a received row.
- const content = { components: [row.setComponents(row.components.filter(x => !x.customId))] };
+ const content = { components: [row.setComponents(row.components.filter(x => !x.data.custom_id))] };
- const content = { components: [row.setComponents(row.components.filter(x => !x.customId))] };
+ const content = { components: [row.setComponents(row.components.filter(x => !x.data.custom_id))] };
27 Replies
TheRealGodSpeedy
hmmm
Mozzy
MozzyOP3y ago
console.log(row) returns:
ActionRowBuilder {
data: { type: 1 },
components: [
ButtonBuilder { data: [Object] },
ButtonBuilder { data: [Object] },
ButtonBuilder { data: [Object] }
]
}
ActionRowBuilder {
data: { type: 1 },
components: [
ButtonBuilder { data: [Object] },
ButtonBuilder { data: [Object] },
ButtonBuilder { data: [Object] }
]
}
TheRealGodSpeedy
what? ya v14 is confusing hold on why the "data"? like after !x.
monbrey
monbrey3y ago
No idea what that's for exactly
TheRealGodSpeedy
same
monbrey
monbrey3y ago
Are you running into a particular issue? data is meant to just be the internal storage
Mozzy
MozzyOP3y ago
It's for removing any buttons that aren't function buttons (only keep LINK buttons)
monbrey
monbrey3y ago
Right, so modifying an actionrowbuilder? To remove buttons from it?
TheRealGodSpeedy
oh i see
Mozzy
MozzyOP3y ago
Yeah
TheRealGodSpeedy
thats why its more complicated than usual
monbrey
monbrey3y ago
Yeah I said in the builders RFC this would be needed lol
Mozzy
MozzyOP3y ago
Did I miss this change in the breaking changes?
monbrey
monbrey3y ago
I would probably do row.setComponents(row.components.filter(x => x.style === ButtonStyle.Link)) Could you not advertise your question in other people's threads? Very rude
TheRealGodSpeedy
sry ComponentType.Link thats new
monbrey
monbrey3y ago
Oh oops ButtonStyle.Link
Mozzy
MozzyOP3y ago
I am confused
Mozzy
MozzyOP3y ago
I'm probably doing something obviously wrong
monbrey
monbrey3y ago
Hmmmm why didn't the enum work
Mozzy
MozzyOP3y ago
nvm. x.data.style
monbrey
monbrey3y ago
Oh right
Mozzy
MozzyOP3y ago
Which is what also confused me from the start
monbrey
monbrey3y ago
Fuck I hate builders My bad
Mozzy
MozzyOP3y ago
So, is this data property a new v14 thing I missed somewhere?
monbrey
monbrey3y ago
Nope Has been in builders all along as far as I know
Mozzy
MozzyOP3y ago
So the change is that in row.components.filter(x => !x.customId), x.<customId> no longer exists? I've never worked with anything other than builders for message components, but I might have to switch to avoid confusing myself 😅 Oh well, looking into ditching the builder method This seems to do the trick after I've remade all the components without builders
interaction.editReply({ components: [{ ...row, components: row.components.filter(x => x.style === ButtonStyle.Link) }] })
interaction.editReply({ components: [{ ...row, components: row.components.filter(x => x.style === ButtonStyle.Link) }] })

Did you find this page helpful?