add bot leave group action

This commit is contained in:
Jay 2018-07-13 23:04:54 +08:00
parent 4c56ff4300
commit cc5970d70c

View File

@ -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
}