Trouble editing buttons in ActionRow

I have this external button command file, and when a button that is linked to that file is clicked it is supposed to grab the action row, edit the buttons on the action row and then after that it sends the action row with the edited buttons
20 Replies
d.js docs
d.js docs2y ago
Tag suggestion for @..noxxe..: If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. • Once you do, log relevant values and if-conditions • More sophisticated debugging methods are breakpoints and runtime inspections: learn more
Noxxe
Noxxe2y ago
@qjuh What do you want me to log?
Mozzy
Mozzy2y ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Noxxe
Noxxe2y ago
Here is my code.
Mozzy
Mozzy2y ago
messageActionRow1 and messageActionRow2 are the old and unedited ActionRows, no?
Noxxe
Noxxe2y ago
Indeed! and then it grabs the buttons from them and edits them. and then sends the actionrows again. I though that it's the same logic as v13
Mozzy
Mozzy2y ago
I don't think it does It just puts the new buttons in the const ... = ButtonBuilder.from(...)
Noxxe
Noxxe2y ago
no.
ActionRow {
data: { type: 1 },
components: [
ButtonComponent { data: [Object] },
ButtonComponent { data: [Object] },
ButtonComponent { data: [Object] }
]
}
ActionRow {
data: { type: 1 },
components: [
ButtonComponent { data: [Object] },
ButtonComponent { data: [Object] },
ButtonComponent { data: [Object] }
]
}
No extra buttons after it has been edited. Enable, Disable, Exit Those are the buttons that are unedited embed.
Mozzy
Mozzy2y ago
Right, but in my eyes, you just define enablebuttone and disablebuttone, but never actually send them anywhere
Noxxe
Noxxe2y ago
that was to edit the buttons, so how would I edit the actionrow to include the edited buttons. and still keep the exit button
Mozzy
Mozzy2y ago
You would probably need to use const newRow = ActionRowBuilder.from(messageActionRow1) judging by the breaking changes guide
Noxxe
Noxxe2y ago
Ok i'll try that.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Noxxe
Noxxe2y ago
no
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Noxxe
Noxxe2y ago
it's really pissing me off, I'll keep this open for now and if find a solution I will let you know I HAVE FIGURED IT OUT!!!
Noxxe
Noxxe2y ago
You have to store the old action row as a new one, and then edit the buttons from the new action row and then update the message components. Just ignore line 17
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Noxxe
Noxxe2y ago
np!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View