Ask coding questions

← Back to all posts
basic Discord bot issues node.js
Mathman05

I have a discord server that I have my bot on and I have a channel I would like it to post to, I can figure out how to get the channel. Does anyone know how I would do this?

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
Mathman05
Comments
hotnewtop
SixBeeps

First get the channel ID

Then fetch the ID in code and send a message to it

Coder100

but that's only if you know the id, and sometimes you don't know the id? @SixBeeps

SixBeeps

@Coder100 No, you'll always have access to the ID as long as the channel is visible. Either way, using the channel name is more intuitive, so your answer is better.

Mathman05

@SixBeeps thanks I can't test it right now but that should work! I know the ID.

Mathman05

@SixBeeps yup that worked!

Coder100
Mathman05

@Coder100 I already have the ID and it's not responding to a message. it's just making a message.