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
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@qjuh What do you want me to log?
This might be relevant https://discordjs.guide/additional-info/changes-in-v14.html#messagecomponent
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Here is my code.
messageActionRow1
and messageActionRow2
are the old and unedited ActionRows, no?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
I don't think it does
It just puts the new buttons in the const ... = ButtonBuilder.from(...)
no.
No extra buttons after it has been edited.
Enable
, Disable
, Exit
Those are the buttons that are unedited embed.Right, but in my eyes, you just define
enablebuttone
and disablebuttone
, but never actually send them anywherethat was to edit the buttons, so how would I edit the actionrow to include the edited buttons.
and still keep the exit button
You would probably need to use
const newRow = ActionRowBuilder.from(messageActionRow1)
judging by the breaking changes guideOk i'll try that.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
no
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
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!!!
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•3y ago
Message Not Public
Sign In & Join Server To View
np!
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View