#Getting a Guild by its ID

1 messages · Page 1 of 1 (latest)

sudden turtle
#

Are you sure the id is correct?

#

It should be something like 848176216011046962

vale dock
#
  • check the id
  • make sure you have Guilds intent enabled
#
  • with a debugger view check Guilds property of DiscordSocketClient
#
  • make sure you do all of this after client is ready
#

without Guilds intent discord doesn't send guilds to the client on startup, so it has no idea what guilds it is in => returns null
also, Guilds intent is enabled by default & is part of All & AllUnpriviliged intent "groups"

sudden turtle
#

await

#

Or do you mean you send the command before the client could download the guilds?

vale dock
#

well
you could add a bool somewhere

#

& set it to true when Ready event fires

#

i believe there's not really any other way

sudden turtle
#

Yeah, hooking the Ready event is the good way then

#

As you can see here it's always after