const cache = require('./cache.js'); module.exports = client => { return new Promise((resolve, reject) => { console.info(`Logged in as ${client.user.tag}!`); console.info(`[BOOT] Initiating state manager...`); Promise.all(client.guilds.cache.map(guild => cache.init(guild.id))) .then(() => resolve()) .catch(err => console.error(err)); console.info(`[BOOT] Locating game channels...`); client.guilds.cache.each(guild => { let channel = guild.channels.cache.find(channel => channel.name === 'machine'); if(channel) { console.info(`[${guild.id}] Found machine channel`); channel.send(`\`[${guild.id}] NeverSteam Engine v2 startup successful\``) .then(() => console.info(`[${guild.id}] Sent startup notification`)) .catch(console.error); } else { console.info(`[${guild.id}] Could not find machine channel`); } }); }) }