Bot not appearing in member list

I am trying to get started following the discordjs.guide, but the discord bot is not appearing in the channel list as online, like expected. I used the default install link on the Installation tab of the Discord Developer Portal. I am getting the expected console.logs:
client.once(Events.ClientReady, (readyClient) => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`)
})

// Log in to Discord with your client's token
client.login(process.env.DISCORD_BOT_TOKEN).then((onfulfilled) => {
console.log("Logged in to client")
})
client.once(Events.ClientReady, (readyClient) => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`)
})

// Log in to Discord with your client's token
client.login(process.env.DISCORD_BOT_TOKEN).then((onfulfilled) => {
console.log("Logged in to client")
})
It is showing up in Server Settings => Integrations. I also tried giving it a role with admin perms but it still doesn't show up so I assume it's just offline. I tried continuing with the guide to see if it would work after setting up slash commands but the setup script updated 0 servers and slash commands do not work. I also wanted to try manually sending a message in a channel but the channel cache is just an empty Collection so channel is undefined and theres nowhere to send the message to:
const channel = client.channels.cache.get(channelId)
console.log("client.channels.cache :>> ", client.channels.cache)
console.log("channel :>> ", channel)
const channel = client.channels.cache.get(channelId)
console.log("client.channels.cache :>> ", client.channels.cache)
console.log("channel :>> ", channel)
4 Replies
d.js toolkit
d.js toolkit4mo 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
luna 🐇
luna 🐇OP4mo ago
[email protected] node v20.0.0
Squid
Squid4mo ago
You need to select the bot scope when creating your invite link if you want it to be a member of the server (which you do)
luna 🐇
luna 🐇OP4mo ago
Thank you! That worked for seeing it in members list and sending the channel message. Slash command script still not working but ill worry about that another time
Want results from more Discord servers?
Add your server