This commit is contained in:
parent
10d3ef32cb
commit
03c8796c49
@ -23,8 +23,8 @@ export const getMsgType = (body: LarkEvent.Data) => {
|
||||
* @param body 事件消息体
|
||||
* @returns 对话流Id
|
||||
*/
|
||||
export const getChatId = (body: LarkEvent.Data) => {
|
||||
return body?.event?.message?.chat_id
|
||||
export const getChatId = (body: LarkEvent.Data & LarkAction.Data) => {
|
||||
return body?.event?.message?.chat_id || body?.open_chat_id
|
||||
}
|
||||
|
||||
/**
|
||||
@ -36,24 +36,6 @@ export const getUserId = (body: LarkEvent.Data) => {
|
||||
return body?.event?.sender?.sender_id?.user_id
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为Action消息
|
||||
* @param body Action消息体
|
||||
* @returns 是否为Action消息
|
||||
*/
|
||||
export const getIsActionMsg = (body: LarkAction.Data) => {
|
||||
return !!body?.action
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Action类型
|
||||
* @param body Action消息体
|
||||
* @returns Action类型
|
||||
*/
|
||||
export const getActionType = (body: LarkAction.Data) => {
|
||||
return body?.action?.tag
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文本内容并剔除艾特信息
|
||||
* @param body 事件消息体
|
||||
@ -88,4 +70,40 @@ export const getMentions = (body: LarkEvent.Data) => {
|
||||
return body?.event?.message?.mentions
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为Action消息
|
||||
* @param body Action消息体
|
||||
* @returns 是否为Action消息
|
||||
*/
|
||||
export const getIsActionMsg = (body: LarkAction.Data) => {
|
||||
return !!body?.action
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Action类型
|
||||
* @param body Action消息体
|
||||
* @returns Action类型
|
||||
*/
|
||||
export const getActionType = (body: LarkAction.Data) => {
|
||||
return body?.action?.tag
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Action参数
|
||||
* @param body Action消息体
|
||||
* @returns Action参数
|
||||
*/
|
||||
export const getActionValue = (body: LarkAction.Data) => {
|
||||
return body?.action?.value
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Action选项
|
||||
* @param body Action消息体
|
||||
* @returns Action选项
|
||||
*/
|
||||
export const getActionOption = (body: LarkAction.Data) => {
|
||||
return body?.action?.option
|
||||
}
|
||||
|
||||
export { LarkAction, LarkEvent }
|
||||
|
Loading…
x
Reference in New Issue
Block a user