mtfosbot/index.js
2018-08-25 20:54:35 +08:00

23 lines
593 B
JavaScript

require('module-alias/register')
const fs = require('fs')
const fork = require('child_process').fork
const path = require('path')
try {
fs.accessSync(path.resolve(__dirname, '.env'))
require('dotenv').config()
} catch (err) {}
require('./app')
const event = require('./event')
let bgProc = fork('./background.js')
bgProc.on('message', data => {
if ('type' in data && 'data' in data) {
event.emit(data.type, data.data)
}
})
bgProc.on('close', () => {
console.log(`background close`)
})
//require('./background')
const twitchChat = require('./libs/twitch-bot')
twitchChat.runBot()