diff --git a/index.js b/index.js index e86d78e..bcff18d 100644 --- a/index.js +++ b/index.js @@ -40,19 +40,26 @@ client.on('ready', async () => { // Get all invites client.invites = []; // Update Invites - client.guilds.cache.forEach(guild => { //on bot start, fetch all guilds and fetch all invites to store + console.log(`${colors.cyan("[INFO]")} Fetching Invites...`); + await client.guilds.cache.forEach(guild => { //on bot start, fetch all guilds and fetch all invites to store + thisGuild = [] guild.invites.fetch().then(guildInvites => { guildInvites.each(guildInvite => { client.invites[guildInvite.code] = guildInvite.uses + thisGuild.push(guildInvite.code) }) + }).then(() => { + console.log(`${colors.cyan("[INFO]")} Fetched ${thisGuild.length} Invites for ${colors.green(guild.name)}`); }) guild.fetchVanityData().then(vanityData => { client.invites[vanityData.code] = vanityData.uses }).catch(err => { // Do nothing }) + }) + // Register commands const commands = [