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 docs3y 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
NoxxeOP3y ago
@qjuh What do you want me to log?
Mozzy
Mozzy3y ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Noxxe
NoxxeOP3y ago
Here is my code.
Mozzy
Mozzy3y ago
messageActionRow1 and messageActionRow2 are the old and unedited ActionRows, no?
Noxxe
NoxxeOP3y 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
Mozzy3y ago
I don't think it does It just puts the new buttons in the const ... = ButtonBuilder.from(...)
Noxxe
NoxxeOP3y 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
Mozzy3y ago
Right, but in my eyes, you just define enablebuttone and disablebuttone, but never actually send them anywhere
Noxxe
NoxxeOP3y 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
Mozzy3y ago
You would probably need to use const newRow = ActionRowBuilder.from(messageActionRow1) judging by the breaking changes guide
Noxxe
NoxxeOP3y ago
Ok i'll try that.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Noxxe
NoxxeOP3y ago
no
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Noxxe
NoxxeOP3y 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
NoxxeOP3y 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 User3y ago
Message Not Public
Sign In & Join Server To View
Noxxe
NoxxeOP3y ago
np!
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server