MediaGalleryBuilder() error.
I've been encountering this error in which I pass the
attachment://file.png in the MediaGalleryBuilder().media.url and send the AttachmentBuilder() in the files array, but it still outputs the error of it not encountering the file sent.
As of now, the code is quite unpolished and really scraped on for "testing purposes", but it should work just fine; but, it doesn't.
33 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!And this is the class getComponent() method:
As I said, the code its pretty raw as of now, but the methods should output no error at all.
This is the AttachmentBuilder's console.log().
And this is the error I've been getting:
Uncaught exception: DiscordAPIError[50035]: Invalid Form Body
components[0].components[1].items[0].media.url[UNFURLED_MEDIA_ITEM_REFERENCED_ATTACHMENT_NOT_FOUND]: The referenced attachment ("attachment://votación.png") was not found
Whenever I crtl + click the file link it outputs in the terminal, it sends me to the actual file, so I really don't know why this is failing. I've also tried this method in another file, and worked just fine.
This is the one that works:
The rules embed constructor gets as a first arg the actual timestamp to place it at the message, then the second arg is placed in mediagallery's media.url property exactly as it's passed in the constructor.
This is the preview of the working one.

sorry this comes off as mean but This code is nonsense
StartUpEmbed is not a builder ins d.js. also you dont need the MessageFlags.SuppressEmbeds because cv2 disables embed
Take a look at the exampleNo, I'm building them as classes for them to be reusable later on. Those classes use d.js builders.
ya got it, sorry about that
For example
And within, I use the d.js Builders.
dw
Work to understand your error but the the
MessageFlags.SuppressEmbeds thing is still trueI get that the code may seem sketchy and bad written, but technically the data that is being posted to discord to send to the channel is valid. Though it does not recognize the attachment.
Oh, oke, ty
I used it as a precaution, never really had it embed it b4.
See how in the terminal it shows the AttachmentBuilder work well but when sent, just randomly breaking.
ok so the error your getting is related to
votación.png but I am unsure why it is throwing an error. To me it looks like it should work.Right?
like the error is the the file was not uploaded but you did attach it
That's why I'm confused.
I've alreadh rebooted it, loaded the file manually and nothing.
Already.*
what if you used the item builder not sure it would change anything but worth a try
Lemme try
the only other thing I can think of is using a non ASCII character
ó could be the issue but I hope that is not itCan you show the getEmbed method?
I think not, because I ran into the same conclussion, but discord supports those characters to be sent on files.
This is the getComponent() method.
Or are you talking about the RulesEmbed() one.
?*
but for the rules code could you share the getEmbed function
In that case, getEmbed() just returns this.container, as all of it is handled in the constructor itself.
Or I’m getting lost
Yeh, I'm quite unirganized.
So
There's the RulesEmbed() constructor, in which you pass two args: date and the attachment url. All of the component methods are andled in that constructor, and I only call getEmbed(), which should be get Constructor() to retrieve the container built in the contructor()
Hope it makes quite more sense now.
At this point I would unpack your class so it is just the builders in the file were you are sending the message
and see if you have the error
Should I?
Because I was thinking on handling the AttachmentBuilder in tbe same class file, but then I found it pointless, as it's really just the same.
The.*
I'm not showing direct code snippets, which would be easier, as I've turned off my machine, but I hope the explanations of the code are good enough for you both to understand.
Can’t rly debug anything
I’d say just try using characters without accents for the name
Let me turn on my PC to send the class that works.
I'll try that as well.
It feels like that is the issue to me. but I would be kind of disappointed if it is
Whelp, I'm disapponted to be the one who tells you, but apparently that was the issue.
Thanks guys.
I just switched it from votación to votacion. Not the file tho, just the AttachmentBuilder()'s name and attachment://file.png's name.
Thanks for the support.
Interesting. Glad it works for you now. It probably has something to do with URL formatting
May be it.
Thanks.
Ty