diff --git a/libs/line-message/index.js b/libs/line-message/index.js index d911280..61d6730 100644 --- a/libs/line-message/index.js +++ b/libs/line-message/index.js @@ -1,12 +1,17 @@ const commands = require('./commands') const api = require('../api-action') +const DB = require('@libs/database') /** * parse text message object * @param {object} evt line message event object */ const textMessage = async (evt) => { - let {replyToken, source, message} = evt + let {replyToken, source, message, type} = evt + if (type === 'leave' && 'groupId' in source && 'type' in source && source.type === 'group') { + await leaveGroup(source.groupId) + return + } if (!source || !('type' in source) || source.type !== 'group') return if (!message || message.type !== 'text') return let {text} = message @@ -22,6 +27,10 @@ const textMessage = async (evt) => { } } +const leaveGroup = async (group = '') => { + +} + module.exports = { textMessage }