Problem with Action Row
I have a problem with building new ActionRowBuilders from existed message.
I am creating a tool for user to customize message, button, etc...
First, I fetch a message via user provided url. Then I create an array of ActionRowBuilders from
message.components
value (as code below).
After letting the user edit, I will send the sample message to the user for confirmation. When I send the confirmation message an error occurs:
After some testing, I noticed that when a button is fetched from a message that contains no emoji, just text, there is no label field, only an emoji field (emoji: null
). Instead, the text field is stored in the data
value.
Like in this case, the button with emoji will have a corresponding emoji field but the button with text only will not have a label field.
So is there any way to fix this error?
Version:
* Discord.JS: [email protected]
* Bun: docker image oven/bun:alpine
P/s: I'm sorry if I confused you because my English is quite bad ;-;
3 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OP:method: (static) ActionRowBuilder#from()
[email protected]
Creates a new action row builder from JSON data
Structures from the API cannot be edited directly. To do so, you can create a new structure (a builder) using the .from()
method
It works. Thanks for the quick support :luv: