Issues with sending embeds
Hi, I have a discord bot which sends DMs directly to users (for notifications) including an embed, recently, ive done an update which removed the embeds directly from the code files, and added them to a specific embeds.js, and made each embed a function which returns the embed, because some data in the embed is personalized for the specific message or user.
Recently though, when i try to send a DM with an embed after this change that I did, the messages don't get sent. The error stack:
https://pastebin.com/GPdgFNZz
Pastebin
C:\Users\OneDrive\Desktop\Code\node_modules@sapphire\shapes - Pa...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
30 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!Node version v18.17.0
[email protected]
one of your fields has an invalid value, please show embeds.js line 93 please
Sure
config.supportinvite is a string, the servers invite
warning id is a mongodb id with .toString()
user id is a discord user id (input validated, string)
reason is input validated to be a string too
can you add this to your code and show the full log?
sure
1 sec will run it now
Discord
Discord | Your Place to Talk and Hang Out
Discord is the easiest way to talk over voice, video, and text. Talk, chat, hang out, and stay close with your friends and communities.
The undefined shouldnt be there
so then
userid
is undefinedI will need to check that rn lol
also, maybe change that invite
/ dont show it
No i changed it to xxxxxx
its still a valid invite
Not to my server lol
doesnt matter
Ok now its random
👍
Ok ill now need to check why the userid is undefined
Really strange lol
damn i found it
I did input validation but forgot to put in the input validated strings
Ok the embed issue is fixed but now theres something else let me see if i can fix that before I ask for help ont hat onet oo
did you get it fixed?
no lol it was way more advanced than i thought
so whats happening is
it saves a warning for a user, and then dms the warned user, all successfully
but then the api i have for warning users returns a error 500
and this
ill try to send more info now
honestly the only way that it can error out is when the promise rejects
but the only way i programmed the promise to reject is when it doesnt save the warning successfully to the database
how is that even possible
do you think u can help @grass ?
what does warnNow return
it returns a promise
what does it resolve to
what do you mean like the value it resolves?
cause when i just do resolve()
when you resolve the promise it returns, what value do you have
i just do resolve(); without any value
so then
res
is undefinedyes
therefore you cannot call send() on it
.then((res) => {
res.send({ status: true, content: "Successfully warned user." });
return;
})
i just realized
res is the response of the promise
but also the response for express js
damn
thats the issu
bro you helped me so much frfr
ty bro
it actually works now
everything