FridayNightFunkinBoyfriendBot/src/index.js

40 lines
1.3 KiB
JavaScript
Raw Normal View History

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');
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');
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
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);
}
checks(config);
/*if (config.core.method !== 'item' && config.core.method !== 'chat') {
config.core.method = 'item';
console.warn('invalid core method type defaulting to item');
}*/
2024-07-07 15:44:16 -04:00
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})
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 = [];
for (const options of config.bots) {
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);
bot.console.readlineInterface(rl);
2024-07-07 15:44:16 -04:00
}