How do i send messages in a Forum Channel

assuming i have the channel stored in the channel variable, how would i send a message to it? Any clue? I've scoured https://discord.js.org/docs/packages/discord.js/main/ForumChannel:Class
discord.js | ForumChannel
Represents a forum channel.
8 Replies
d.js toolkit
d.js toolkit11mo 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
Ateeb Sohail
Ateeb SohailOP11mo ago
- 14.14.1
Koy
Koy11mo ago
The same way you would normally send a message.
Ateeb Sohail
Ateeb SohailOP11mo ago
Property 'send' does not exist on type 'ForumChannel'.ts(2339)
(channel as ForumChannel).send()
(channel as ForumChannel).send()
Svitkona
Svitkona11mo ago
a ForumChannel has threads (a collection of ThreadChannels) you can send messages to individual threads or you can create a new thread
Ateeb Sohail
Ateeb SohailOP11mo ago
oh right my bad and i get the thread id and use it to fetch the channel using <channel>.threads.fetch
msg = await (channel as ForumChannel).threads.create({ name: post.jobTitle, message: {embeds: [embed], components: [btnRow]}, appliedTags: tags});
(channel as ForumChannel).threads.fetch(msg.id).then()
msg = await (channel as ForumChannel).threads.create({ name: post.jobTitle, message: {embeds: [embed], components: [btnRow]}, appliedTags: tags});
(channel as ForumChannel).threads.fetch(msg.id).then()
Svitkona
Svitkona11mo ago
sounds about right i'd rename msg to newThread, and you don't need to fetch it again create will return the newly created ThreadChannel
Ateeb Sohail
Ateeb SohailOP11mo ago
thank you Here's my working code for anyone in the future
newThread = await (channel as ForumChannel).threads.create({ name: post.jobTitle, message: {embeds: [embed], components: [btnRow]}, appliedTags: tags});
(channel as ForumChannel).threads.fetch(newThread.id).then(thread => {thread?.send({content: 'Hello World!'})})
newThread = await (channel as ForumChannel).threads.create({ name: post.jobTitle, message: {embeds: [embed], components: [btnRow]}, appliedTags: tags});
(channel as ForumChannel).threads.fetch(newThread.id).then(thread => {thread?.send({content: 'Hello World!'})})
Want results from more Discord servers?
Add your server