The Client.guilds object is a GuildManager object, and trying to get it's size will return undefined. Instead, we should query Client.guilds.cache to get a Collection object, which extends Map and does have the size property. Naturally the data stored in Client.guilds.cache is cached and can be out of date by the time it's called, but in the given scenario (bot just booted up), it's unlikely to be inaccurate enough to make a difference.
The Client.guilds object is a GuildManager object, and trying to get it's size will return undefined. Instead, we should query Client.guilds.cache to get a Collection object, which extends Map and does have the size property. Naturally the data stored in Client.guilds.cache is cached and can be out of date by the time it's called, but in the given scenario (bot just booted up), it's unlikely to be inaccurate enough to make a difference.