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
TheRealGodSpeedy•2y ago
hmmm
Mozzy
Mozzy•2y 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
TheRealGodSpeedy•2y ago
what? ya v14 is confusing hold on why the "data"? like after !x.
monbrey
monbrey•2y ago
No idea what that's for exactly
TheRealGodSpeedy
TheRealGodSpeedy•2y ago
same
monbrey
monbrey•2y ago
Are you running into a particular issue? data is meant to just be the internal storage
Mozzy
Mozzy•2y ago
It's for removing any buttons that aren't function buttons (only keep LINK buttons)
monbrey
monbrey•2y ago
Right, so modifying an actionrowbuilder? To remove buttons from it?
TheRealGodSpeedy
TheRealGodSpeedy•2y ago
oh i see
Mozzy
Mozzy•2y ago
Yeah
TheRealGodSpeedy
TheRealGodSpeedy•2y ago
thats why its more complicated than usual
monbrey
monbrey•2y ago
Yeah I said in the builders RFC this would be needed lol
Mozzy
Mozzy•2y ago
Did I miss this change in the breaking changes?
monbrey
monbrey•2y 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
TheRealGodSpeedy•2y ago
sry ComponentType.Link thats new
monbrey
monbrey•2y ago
Oh oops ButtonStyle.Link
Mozzy
Mozzy•2y ago
I am confused
Mozzy
Mozzy•2y ago
I'm probably doing something obviously wrong
monbrey
monbrey•2y ago
Hmmmm why didn't the enum work
Mozzy
Mozzy•2y ago
nvm. x.data.style
monbrey
monbrey•2y ago
Oh right
Mozzy
Mozzy•2y ago
Which is what also confused me from the start
monbrey
monbrey•2y ago
Fuck I hate builders My bad
Mozzy
Mozzy•2y ago
So, is this data property a new v14 thing I missed somewhere?
monbrey
monbrey•2y ago
Nope Has been in builders all along as far as I know
Mozzy
Mozzy•2y 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) }] })