Compare commits
2 Commits
@egg/lark-
...
@egg/lark-
Author | SHA1 | Date | |
---|---|---|---|
47c23a7ad6 | |||
23e7404902 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -12122,7 +12122,7 @@
|
||||
},
|
||||
"packages/lark-msg-tool": {
|
||||
"name": "@egg/lark-msg-tool",
|
||||
"version": "1.11.1",
|
||||
"version": "1.12.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@egg/logger": "^1.4.4",
|
||||
|
@ -3,6 +3,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.12.0](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/lark-msg-tool@1.11.1...@egg/lark-msg-tool@1.12.0) (2024-10-15)
|
||||
|
||||
### Features
|
||||
|
||||
- **lark-msg:** 支持获取原始text ([23e7404](http://yingbo.im:3000/zhaoyingbo/egg_tools/commits/23e7404902030b0f41cf153ccc95c7206687113b))
|
||||
|
||||
## [1.11.1](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/lark-msg-tool@1.11.0...@egg/lark-msg-tool@1.11.1) (2024-10-15)
|
||||
|
||||
**Note:** Version bump only for package @egg/lark-msg-tool
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@egg/lark-msg-tool",
|
||||
"version": "1.11.1",
|
||||
"version": "1.12.0",
|
||||
"description": "Lark Msg Tools for Egg projects",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
|
@ -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