mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 15:47:57 -05:00
31 lines
790 B
JavaScript
31 lines
790 B
JavaScript
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);
|