mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
30 lines
871 B
JavaScript
30 lines
871 B
JavaScript
const readline = require('node:readline');
|
|
const {stdin: input, stdout: output} = require('node:process');
|
|
const rl = readline.createInterface({input, output});
|
|
const config = require('./config');
|
|
const {loadPlugins} = require('./util/loadPlugins');
|
|
const {createBot} = require('./bot');
|
|
const {
|
|
Client,
|
|
Intents,
|
|
} = require('discord.js');
|
|
const intents = new Intents(['GUILDS', 'GUILD_MESSAGES']);
|
|
const dcclient = new Client({
|
|
intents,
|
|
});
|
|
|
|
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, rl);
|
|
await loadPlugins(bot, dcclient, config, rl, true);
|
|
bot.console.setRl(rl);
|
|
bots.push(bot);
|
|
});
|
|
});
|
|
|
|
dcclient.login(config.discord.token);
|