feat(lark-msg-tool): 添加 openId 属性及获取方法以支持用户身份识别
All checks were successful
/ release (push) Successful in 27s
All checks were successful
/ release (push) Successful in 27s
This commit is contained in:
parent
6255af3619
commit
cfbb683564
@ -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 事件消息体
|
||||
|
Loading…
x
Reference in New Issue
Block a user