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,