mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
508b6a64c7
i see its faster so i use it
28 lines
893 B
JavaScript
28 lines
893 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', () => {
|
|
for (const server of config.servers) {
|
|
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)
|
|
})
|