Channel id when bot joins a guild

Hi, I am trying to send a message to a channel when the bot joins a guild. I know how to send it to a system channel, but how can I handle the situation if a system channel is not set? Is there way to get the channel id the bot joined to, or do I just send the message to a random channel?
5 Replies
d.js toolkit
d.js toolkit3d 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! - Marked as resolved by OP
Amgelo
Amgelo3d ago
wouldn't "the channel the bot joined to" be the system channel, assuming you mean the channel where the welcome message appears? because otherwise there isn't channels a bot "joins", the bot joins to the entire guild
IAmBatman
IAmBatmanOP3d ago
I guess you are right, but still, the problem is relevant. guildCreate event has only the guild argument, and using guild.systemChannelId returns null if there is no system channel. I don't know where to send the message.
Amgelo
Amgelo3d ago
I don't think there's a correct answer to that question it's more of a preference could be the first channel the bot sees (and can send messages to), others send a dm, others just don't do anything, etc
IAmBatman
IAmBatmanOP3d ago
Got it, thank you

Did you find this page helpful?