mtfosbot/index.js

23 lines
593 B
JavaScript
Raw Normal View History

2018-07-13 05:30:54 +00:00
require('module-alias/register')
2018-06-25 10:07:10 +00:00
const fs = require('fs')
2018-08-25 12:54:35 +00:00
const fork = require('child_process').fork
2018-06-25 10:07:10 +00:00
const path = require('path')
try {
fs.accessSync(path.resolve(__dirname, '.env'))
require('dotenv').config()
} catch (err) {}
require('./app')
2018-08-25 12:54:35 +00:00
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')
2018-07-18 16:40:07 +00:00
const twitchChat = require('./libs/twitch-bot')
twitchChat.runBot()