feat(lark-msg-tool): 添加 openId 属性及获取方法以支持用户身份识别
All checks were successful
/ release (push) Successful in 27s

This commit is contained in:
zhaoyingbo 2024-12-02 07:46:07 +00:00
parent 6255af3619
commit cfbb683564

View File

@ -8,6 +8,7 @@ class LarkBody {
public isMessageEvent?: boolean
public msgType?: LarkEvent.Message["message_type"]
public userId?: LarkEvent.UserIdInfo["user_id"]
public openId?: LarkEvent.UserIdInfo["open_id"]
public msgText: string = ""
public rawMsgText: string = ""
public chatType?: LarkEvent.Message["chat_type"]
@ -39,6 +40,7 @@ class LarkBody {
this.isMessageEvent = this.getIsMessageEvent(eventBody)
this.msgType = this.getMsgType(eventBody)
this.userId = this.getUserId(eventBody)
this.openId = this.getOpenId(eventBody)
this.msgText = this.getMsgText(eventBody)
this.rawMsgText = this.getRawMsgText(eventBody)
this.chatType = this.getChatType(eventBody)
@ -112,6 +114,15 @@ class LarkBody {
return body?.event?.sender?.sender_id?.user_id
}
/**
* OpenId
* @param body
* @returns OpenId
*/
private getOpenId(body: LarkEvent.Data) {
return body?.event?.sender?.sender_id?.open_id
}
/**
*
* @param body