Merge branch 'master' into release

This commit is contained in:
Jay 2018-08-25 20:55:45 +08:00
commit cfc68243e0
2 changed files with 21 additions and 5 deletions

View File

@ -308,9 +308,15 @@ const checkDonate = async (loginName = null, opayid = null) => {
values
})
let msg = `/me 感謝 ${i.name} 贊助了 ${i.amount} 元, ${i.msg}`
event.emit('twitchSend', {
msg,
channel: loginName
//event.emit('twitchSend', {
// msg,
// channel: loginName
//})
process.send({
type: 'twitchSend',
data: {
msg, channel: loginName
}
})
} catch (err) {
console.log(err)

View File

@ -1,12 +1,22 @@
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')
require('./background')
require('./event')
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()