const config = require('./config'); const {createBot} = require('./bot'); const { Client, Intents, } = require('discord.js'); const intents = new Intents(['GUILDS', 'GUILD_MESSAGES']); const dcclient = new Client({ intents, }); // readline > fix on console.log // const log = console.log; // console.log = function() { // rl.output.write('\x1b[2K\r'); // log.apply(console, Array.prototype.slice.call(arguments)); // rl._refreshLine(); // }; const bots = []; dcclient.on('ready', () => { config.servers.forEach(async (server) => { const getBots = () => bots; // await is important cuz the function is async // VVVVV const bot = await createBot(server, config, getBots, dcclient); bots.push(bot); }); }); dcclient.login(config.discord.token);