Why are my embeds not sent but Files are?

I'm using this payload in a raw rest.post() request and the files are being sent, but not the embeds. Why? I have based the code on the original code from djs.
payload = {
body: {
payload_json: {
embeds: [
{
// ...
},
],
},
},
files: files, // That goes through
} as RESTPostAPIChannelMessageFormDataBody;

...

await ctx.client.rest.post(
Routes.channelMessages(postId),
payload
)
payload = {
body: {
payload_json: {
embeds: [
{
// ...
},
],
},
},
files: files, // That goes through
} as RESTPostAPIChannelMessageFormDataBody;

...

await ctx.client.rest.post(
Routes.channelMessages(postId),
payload
)
No description
13 Replies
d.js toolkit
d.js toolkit4d 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!
monbrey
monbrey4d ago
payload_json is not a valid property of the body? Where did yoiu get that from
LukeZ
LukeZOP4d ago
discord docs + djs code gimme a second
monbrey
monbrey4d ago
doubt Yeah
LukeZ
LukeZOP4d ago
No description
monbrey
monbrey4d ago
huh, thats odd Ive always just passed it directly as body
LukeZ
LukeZOP4d ago
like
let sendOptions = { payload_json: {}, files: files }
let sendOptions = { payload_json: {}, files: files }
monbrey
monbrey4d ago
ahh right
LukeZ
LukeZOP4d ago
okay, lemme try it I do Wait what :Thinkeng: I give it a try nope, still doesn't work Because I don't have the channel and don#t want to fetch it I'm using raw rest Because it might not be cached -# but that's not the point here
sendOptions = {
payload_json: JSON.stringify({
embeds: [
{
author: {
name: "...",
url: `...`,
},
description: "...",
thumbnail: !ticket.alias
? { url: ctx.user.avatarURL() }
: undefined,
color: 0x<somecolorcode>,
},
],
}),
files: files,
} as RESTPostAPIChannelMessageFormDataBody;
sendOptions = {
payload_json: JSON.stringify({
embeds: [
{
author: {
name: "...",
url: `...`,
},
description: "...",
thumbnail: !ticket.alias
? { url: ctx.user.avatarURL() }
: undefined,
color: 0x<somecolorcode>,
},
],
}),
files: files,
} as RESTPostAPIChannelMessageFormDataBody;
d.js docs
d.js docs4d ago
:class: MessagePayload @14.16.3 Represents a message to be sent to the API.
LukeZ
LukeZOP4d ago
I wanted to use this, but I would still need the channel tho I tried using it but the target needs to be set - I might not have it in the cache
LukeZ
LukeZOP4d ago
uuuh
No description
LukeZ
LukeZOP4d ago
[x] doubt I might just use the interaction.user and resolve the body there it's not sent to the user but it might work since I just need the body noted
Want results from more Discord servers?
Add your server