chomens-bot-js/index.js
2022-11-14 17:45:49 +07:00

32 lines
799 B
JavaScript

/* eslint-disable max-len */
/* eslint-disable no-var */
/* eslint-disable prefer-rest-params */
/* eslint-disable no-tabs */
/* eslint-disable no-undef */
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) => {
createBot(server, config, bots, dcclient);
});
});
dcclient.login(config.discord.token);