thread send message

yo, how can i send a message to a thread id i specified via my discord bot?
6 Replies
d.js toolkit
d.js toolkit7mo 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!
sercan
sercanOP7mo ago
const thread = await client.channels.fetch(threadId);
if (thread) {
await thread.send(messageContent);
console.log('Message sent to thread!');
} else {
console.log('Thread not found!');
}
const thread = await client.channels.fetch(threadId);
if (thread) {
await thread.send(messageContent);
console.log('Message sent to thread!');
} else {
console.log('Thread not found!');
}
i think it works like this, but I couldn't run it, it shows undefined
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
sercan
sercanOP7mo ago
yea but undefined error
_me.xi ツ
_me.xi ツ7mo ago
try logging thread
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server