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