Send message to specific channel
How can I send a message to a specific channel of my guild?
15 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!1. get said channel
2. .send()
can you show me an example?
either guild.channels.cache.get if channels are cached or guild.channels.fetch
- Caches in discord.js are Collections which extend the native Map structure.
- learn more
- Caches in discord.js are Collections which extend the native Map structure.
- learn more
a send method doesnt exists on my channel
Then it isn't a text channel
maybe provide a id?
You're using TypeScript so you need to typeguard it
how?
Check it's type
channel.type === ChannelType.GuildText
Or use .isTextBased()
typescript...
i forgor, ty