CappeDiem / Discord.js-bot-template

Basic bot template with event and command handler
MIT License
60 stars 27 forks source link

Fixed "in X servers" message. #1

Closed Shigbeard closed 3 years ago

Shigbeard commented 3 years ago

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.