2024-07-07 15:44:16 -04:00
|
|
|
const createBot = require('./bot.js');
|
|
|
|
const readline = require('readline');
|
|
|
|
const loadModules = require('./util/loadModules');
|
|
|
|
const js_yaml = require('js-yaml');
|
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
2024-10-23 10:33:14 -04:00
|
|
|
const checks = require('./util/checks');
|
2024-07-07 15:44:16 -04:00
|
|
|
const { Client, GatewayIntentBits } = require('discord.js');
|
|
|
|
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
|
|
|
|
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
|
|
|
|
console.log('Starting FNFBoyfriendBot');
|
2024-12-06 11:04:23 -05:00
|
|
|
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
|
2024-10-30 19:07:14 -04:00
|
|
|
|
2024-07-07 15:44:16 -04:00
|
|
|
try {
|
|
|
|
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e.stack);
|
|
|
|
}
|
2024-12-06 11:04:23 -05:00
|
|
|
|
|
|
|
checks(config);
|
|
|
|
|
|
|
|
/*if (config.core.method !== 'item' && config.core.method !== 'chat') {
|
2024-11-14 09:25:22 -05:00
|
|
|
config.core.method = 'item';
|
|
|
|
console.warn('invalid core method type defaulting to item');
|
2024-12-06 11:04:23 -05:00
|
|
|
}*/
|
2024-07-07 15:44:16 -04:00
|
|
|
const rl = readline.createInterface({
|
|
|
|
input: process.stdin,
|
|
|
|
output: process.stdout,
|
|
|
|
})
|
2024-12-06 11:04:23 -05:00
|
|
|
|
2024-07-20 20:27:17 -04:00
|
|
|
if (config.discord.enabled) discordClient.login(config.discord.token);
|
2024-07-07 15:44:16 -04:00
|
|
|
const bots = [];
|
2024-08-21 12:20:11 -04:00
|
|
|
for (const options of config.bots) {
|
2024-09-13 08:23:42 -04:00
|
|
|
const bot = new createBot(options, config);
|
2024-07-07 15:44:16 -04:00
|
|
|
bots.push(bot);
|
|
|
|
bot.bots = bots;
|
|
|
|
loadModules(bot, options, config, discordClient);
|
2024-09-13 08:23:42 -04:00
|
|
|
bot.console.readlineInterface(rl);
|
2024-07-07 15:44:16 -04:00
|
|
|
}
|