How do I get the current guild id in a client ready event?

I figured it would be client.guild.id but that's undefined. Is there a different way, or can I not access guild in ClientReady?
module.exports = {
name: Events.ClientReady,
once: true,
execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`)
setStatus(client)
},
}
module.exports = {
name: Events.ClientReady,
once: true,
execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`)
setStatus(client)
},
}
8 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Nahana
NahanaOP2y ago
discordjs 14.7.1 node 16.14.0
Idris
Idris2y ago
which guild?
Nahana
NahanaOP2y ago
would be each guild, but the current guild that's "running" my plan is use the guild id to store server configs (log channel, bot role level, etc) and was getting the guild ID in ready to do a check if the record was in the db yet, if not create it that way when someone does say /setlogchannel .. it could pull that guild ID to update that row in teh db
Idris
Idris2y ago
there’s no "current" guild in ready event
Nahana
NahanaOP2y ago
that's what I was thinking was the issue. So ill have to do it when the guild is created, ie bot joins then pull it for each Event
d.js docs
d.js docs2y ago
Documentation suggestion for @nahana:event (event) Client#guildCreate Emitted whenever the client joins a guild.
Nahana
NahanaOP2y ago
thanks!
Want results from more Discord servers?
Add your server