add save line message to log
This commit is contained in:
+31
-1
@@ -95,7 +95,37 @@ const replyMessage = async (replyToken, message) => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* query user info
|
||||
* @param {string} group group id
|
||||
* @param {string} id user id
|
||||
*/
|
||||
const getUserInfo = async (group = '', id = '') => {
|
||||
if (typeof group !== 'string' || group.trim().length === 0) return null
|
||||
if (typeof id !== 'string' || id.trim().length === 0) return null
|
||||
let url = `/group/${group.trim()}/member/${id.trim()}`
|
||||
try {
|
||||
let result = await client({
|
||||
url,
|
||||
method: 'get'
|
||||
})
|
||||
if ('data' in result && typeof result.data === 'object') {
|
||||
let {displayName, userId} = result.data
|
||||
if (typeof displayName !== 'string' || displayName.length === 0) return null
|
||||
if (typeof userId !== 'string' || userId.length === 0) return null
|
||||
return {
|
||||
displayName,
|
||||
userId
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('get user info error :::: ', err)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
pushMessage,
|
||||
replyMessage
|
||||
replyMessage,
|
||||
getUserInfo
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user