How to send a message to a channel?
I've copied the code from the FAQ verbatim:
but typescript complains that
send doesn't exist on channel (note that I've handled the possible nullish value already). I checked the Channel type and it indeed doesn't have send. What am I doing wrong?
9 Replies
- 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 staffUse the proper typeguard
which is?
isTextBased?yes
damn
sorry 😅
that would narrow down the type to voice, text channels and announcement channels
got it 👍
i've been using guards with
Interaction, I dunno why I forgot it with Channel