Compare commits

...

2 Commits

Author SHA1 Message Date
47c23a7ad6 chore(release): publish
- @egg/lark-msg-tool@1.12.0
2024-10-15 07:32:54 +00:00
23e7404902 feat(lark-msg): 支持获取原始text
All checks were successful
/ release (push) Successful in 24s
2024-10-15 07:32:33 +00:00
4 changed files with 26 additions and 2 deletions

2
package-lock.json generated
View File

@ -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",

View File

@ -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

View File

@ -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",

View File

@ -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