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 toolkit5w 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
monbrey5w ago
payload_json is not a valid property of the body? Where did yoiu get that from
LukeZ
LukeZOP5w ago
discord docs + djs code gimme a second
monbrey
monbrey5w ago
doubt Yeah
LukeZ
LukeZOP5w ago
No description
monbrey
monbrey5w ago
huh, thats odd Ive always just passed it directly as body
LukeZ
LukeZOP5w ago
like
let sendOptions = { payload_json: {}, files: files }
let sendOptions = { payload_json: {}, files: files }
monbrey
monbrey5w ago
ahh right
LukeZ
LukeZOP5w 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 docs5w ago
:class: MessagePayload @14.16.3 Represents a message to be sent to the API.
LukeZ
LukeZOP5w 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
LukeZOP5w ago
uuuh
No description
LukeZ
LukeZOP5w 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