This commit is contained in:
parent
fc84a87004
commit
23e7404902
@ -7,6 +7,7 @@ class LarkBody {
|
||||
public msgType?: LarkEvent.Message["message_type"]
|
||||
public userId?: LarkEvent.UserIdInfo["user_id"]
|
||||
public msgText: string = ""
|
||||
public rawMsgText: string = ""
|
||||
public chatType?: LarkEvent.Message["chat_type"]
|
||||
public mentions?: LarkEvent.Mention[]
|
||||
public actionType?: LarkAction.Data["action"]["tag"]
|
||||
@ -33,6 +34,7 @@ class LarkBody {
|
||||
this.msgType = this.getMsgType(eventBody)
|
||||
this.userId = this.getUserId(eventBody)
|
||||
this.msgText = this.getMsgText(eventBody)
|
||||
this.rawMsgText = this.getRawMsgText(eventBody)
|
||||
this.chatType = this.getChatType(eventBody)
|
||||
this.mentions = this.getMentions(eventBody)
|
||||
}
|
||||
@ -102,6 +104,22 @@ class LarkBody {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取原始文本内容
|
||||
* @param body 事件消息体
|
||||
* @returns 原始文本内容
|
||||
*/
|
||||
private getRawMsgText(body: LarkEvent.Data) {
|
||||
try {
|
||||
const { text }: { text: string } = JSON.parse(
|
||||
body?.event?.message?.content
|
||||
)
|
||||
return text
|
||||
} catch {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取聊天类型
|
||||
* @param body 事件消息体
|
||||
|
Loading…
x
Reference in New Issue
Block a user