TextChannel.send only works when sending raw content

Hello , i am fetching a channel and trying to send an embed, and it doesnt work, it only allows me to send a channel when i remove the embed and send raw String content. Here is the code , i have added an example of what works and what doesnt work :
const channel = (await DiscordClient.channels.fetch(
ChannelIds.REVIEWS_CHANNEL
)) as TextChannel;
// this works and sends the message
await channel.send({ content: "message" });

//embed
const embed = new EmbedBuilder()
.setDescription(`**Message:**`)
.setTitle("Review");

// this doesnt work (gets stuck on the await and never prints)
await channel.send({ content: "message", embeds: [embed] });
const channel = (await DiscordClient.channels.fetch(
ChannelIds.REVIEWS_CHANNEL
)) as TextChannel;
// this works and sends the message
await channel.send({ content: "message" });

//embed
const embed = new EmbedBuilder()
.setDescription(`**Message:**`)
.setTitle("Review");

// this doesnt work (gets stuck on the await and never prints)
await channel.send({ content: "message", embeds: [embed] });
Any ideas on why could that be ? Thanks in advance. I am using Discordjs 14.6.0
18 Replies
d.js toolkit
d.js toolkit6mo 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
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Hosfad
HosfadOP6mo ago
1- yeah im working on updating to the latest version 2- its not getting rate limited, nor am i getting any errors in the console. 3- No it just seems to get stuck on that event but the main thread continues to work fine
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Hosfad
HosfadOP6mo ago
I did, pretty much everything before i try to send an embed works but everything after i try to send and embed doesnt
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Hosfad
HosfadOP6mo ago
// this works and sends the message
console.log("before sending message"); // prints
await channel.send({ content: "message" });
console.log("sent message"); // prints

//embed
const embed = new EmbedBuilder()
.setDescription(`**Message:**`)
.setTitle("Review");

console.log("before sending embed"); // prints
// this doesnt work (gets stuck on the await and never prints)
await channel.send({ content: "message", embeds: [embed] });
console.log("embed message sent"); // doesnt print
// this works and sends the message
console.log("before sending message"); // prints
await channel.send({ content: "message" });
console.log("sent message"); // prints

//embed
const embed = new EmbedBuilder()
.setDescription(`**Message:**`)
.setTitle("Review");

console.log("before sending embed"); // prints
// this doesnt work (gets stuck on the await and never prints)
await channel.send({ content: "message", embeds: [embed] });
console.log("embed message sent"); // doesnt print
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Hosfad
HosfadOP6mo ago
Yes sir, it doesnt log from the rest.on not getting rate limited
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Hosfad
HosfadOP6mo ago
No description
Hosfad
HosfadOP6mo ago
Added the rate limit event just before i add my listeners
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Hosfad
HosfadOP6mo ago
No description
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Hosfad
HosfadOP6mo ago
Yeah i tried 😦 , it doesnt throw any error i guess ill setup a new project with the latest discordjs and if that works ill update to latest thanks for the help ahh never mind its actually throwing an error now :
TypeError: isJSONEncodable is not a function
at /home/hosfad/Desktop/SideProjects/07rates-bot/node_modules/discord.js/src/structures/MessagePayload.js:202:9
at Array.map (<anonymous>)
at MessagePayload.resolveBody (/home/hosfad/Desktop/SideProjects/07rates-bot/node_modules/discord.js/src/structures/MessagePayload.js:201:36)
at TextChannel.send (/home/hosfad/Desktop/SideProjects/07rates-bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:171:61)
at Task._execution (/home/hosfad/Desktop/SideProjects/07rates-bot/src/index.ts:69:35)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
TypeError: isJSONEncodable is not a function
at /home/hosfad/Desktop/SideProjects/07rates-bot/node_modules/discord.js/src/structures/MessagePayload.js:202:9
at Array.map (<anonymous>)
at MessagePayload.resolveBody (/home/hosfad/Desktop/SideProjects/07rates-bot/node_modules/discord.js/src/structures/MessagePayload.js:201:36)
at TextChannel.send (/home/hosfad/Desktop/SideProjects/07rates-bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:171:61)
at Task._execution (/home/hosfad/Desktop/SideProjects/07rates-bot/src/index.ts:69:35)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Hosfad
HosfadOP6mo ago
Ughh thats a bummer alright thanks buddy ill update ill let you know Alright i setup a new project with latest discordjs and it works now, i guess its time to update, thank you 🙂 @gwapes
Want results from more Discord servers?
Add your server