Embed Builder Not Defined When Using BroadcastEval

I want to send a message with an embed to a channel that might be in another shard. How can I get Embed Builder or my own embed class to work? Passing it in the context didn't work so far either. Thanks for any help.
No description
24 Replies
d.js toolkit
d.js toolkit3mo ago
- 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
monbrey
monbrey3mo ago
I think it should be possible to require it from within the function
Swyftey
SwyfteyOP3mo ago
I'll try Importing it won't work because it's not at the top of the script unless there is another way
monbrey
monbrey3mo ago
you dont have to import things at the top of the script
Swyftey
SwyfteyOP3mo ago
for es6?
d.js docs
d.js docs3mo ago
:mdn: import() The import() syntax, commonly called dynamic import, is a function-like expression that allows loading an ECMAScript module asynchronously and dynamically into a potentially non-module environment.
Swyftey
SwyfteyOP3mo ago
how exactly to I call it like import("what here")
monbrey
monbrey3mo ago
See above discord.js
Swyftey
SwyfteyOP3mo ago
No description
Swyftey
SwyfteyOP3mo ago
Importing that created a loop. Due to the sharding manager I think i'll try npm:@discordjs/builders
Swyftey
SwyfteyOP3mo ago
No description
Swyftey
SwyfteyOP3mo ago
still this shouldn't be as hard as it is
monbrey
monbrey3mo ago
what are you importing from it Thats not how you use it const { EmbedBuilder } = await import("discord.js")
Swyftey
SwyfteyOP3mo ago
oh pff
monbrey
monbrey3mo ago
429 is a rate limit, so thats a different issue right there
Swyftey
SwyfteyOP3mo ago
I didn't think it was the same yeah it was looping For some reason, if I import something which ( I guess) uses the sharding manager script (index file), it goes into a loop
monbrey
monbrey3mo ago
I mean, I did link you the documentation on it Not quite sure what you mean here I might be wrong and you cant import inside a broadcast, that was just my first idea
Swyftey
SwyfteyOP3mo ago
I didn't see an example My bad trying it
monbrey
monbrey3mo ago
There are 9 examples on the MDN page
Swyftey
SwyfteyOP3mo ago
missed them ¯\_(ツ)_/¯ yeah i'm looking at them right now and not one I see shows it being the same as a variable the way you showed it might be one
Swyftey
SwyfteyOP3mo ago
No description
Swyftey
SwyfteyOP3mo ago
great npm: is needed for deno as far as I am aware
monbrey
monbrey3mo ago
Ahh okay, yeah I was mistaken then Cant dynamic import a module maybe just use JSON? or construct the embed outside the broadcast and pass it in as context
Swyftey
SwyfteyOP3mo ago
How would I properly pass it if I construct the embed outside do I need to specifically use .toJSON or something Nevermind, got it This worked. Thank you

Did you find this page helpful?