Output a message to any channel
Please tell me how I can display a message in any channel of any server?
I mean like:
P.S. Please, attach a code example, I'm just learning)
20 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 OPyou mean every channel?
or a specific channel
I mean the channel that I will indicate by ID
I mean you already have that in your code
you just gotta use it
I have an error
yes, why are you using message there
just channel.send()
You're using an invalid channel Id then
or client aint ready
1217094699664281602
What am I supposed to do with that
channel id is valid. I just change it at the 1st post
Do you have the Guilds intent?
my script:
You're trying to access the channel before the bot is ready, put the channel send stuff inside the ready listener
Can you give an example of how to do this?
It's really not hard, put this code inside the ready listener, which you're already listening for
It really works. Thanks a lot!