From 57a0995c2fda9cc373e9d36b79abed6d725d2d2d Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 12 Feb 2018 23:10:45 +0800 Subject: [PATCH] fix --- libs/botClient.js | 1 - libs/database.js | 12 +++++++++++- libs/twitchParser.js | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libs/botClient.js b/libs/botClient.js index 1a7c5b6..dc993c1 100644 --- a/libs/botClient.js +++ b/libs/botClient.js @@ -9,7 +9,6 @@ ws.on('open', () => { ws.on('message', (data) => { if (typeof data !== 'string') data = data.toString() - }) ws.on('error', (err) => { diff --git a/libs/database.js b/libs/database.js index 0802c10..1c81cf3 100644 --- a/libs/database.js +++ b/libs/database.js @@ -1,2 +1,12 @@ -const pg = require('pg') +const {Pool} = require('pg') const config = require('../config') + +const pool = new Pool({ + user: config.database.user, + password: config.database.pass || null, + port: config.database.port, + host: config.database.host, + database: config.database.db_name +}) + +module.exports = pool diff --git a/libs/twitchParser.js b/libs/twitchParser.js index a54b0c7..0cba6a3 100644 --- a/libs/twitchParser.js +++ b/libs/twitchParser.js @@ -26,14 +26,14 @@ const msgSplit = function (msg) { user, msg: '女裝呢!!!?' } - }else if (m.startsWith('!zoe')) { + } else if (m.startsWith('!zoe')) { return { type: 'msg', channel, user, msg: '跟KKBOX犯沖' } - }else if(m.startsWith('!紫色')) { + } else if (m.startsWith('!紫色')) { return { type: 'msg', channel,