chomens-bot-js/index.js
ChomeNS d417c9f6bb bot.options.host & bot.options.port fix
it is a ploblem for a very long time now
also chip why yesterday chipmunk.land is completely down and why is
chipmunk clone down!?1/?!!
ip change?!? router ploblem?!?!
2023-01-19 17:13:25 +07:00

28 lines
898 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 { createBot } = require('./bot')
const { Client, GatewayIntentBits } = require('discord.js')
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
const dcclient = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
let bots = []
dcclient.on('ready', () => {
config.servers.forEach(async (server) => {
const getBots = () => bots
const setNewBot = (server, bot) => {
bots = bots.filter((eachBot) => eachBot.server.host !== server)
bots.push(bot)
}
createBot(server, config, getBots, setNewBot, dcclient, rl)
})
})
dcclient.login(config.discord.token)
process.on('uncaughtException', (e) => {
console.log('uncaught ' + e.stack)
})