Compare commits

...

2 Commits

Author SHA1 Message Date
c8ef119f36 chore(release): publish
- @egg/net-tool@1.28.0
2025-01-25 09:30:56 +00:00
60f14d6a94 feat(net-tool): 重构消息回复逻辑,新增设置回复消息ID和类型的方法
All checks were successful
/ release (push) Successful in 28s
2025-01-25 09:30:29 +00:00
4 changed files with 32 additions and 19 deletions

2
package-lock.json generated
View File

@ -12394,7 +12394,7 @@
},
"packages/net-tool": {
"name": "@egg/net-tool",
"version": "1.27.0",
"version": "1.28.0",
"license": "ISC",
"dependencies": {
"@egg/logger": "^1.6.0",

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.28.0](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/net-tool@1.27.0...@egg/net-tool@1.28.0) (2025-01-25)
### Features
- **net-tool:** 重构消息回复逻辑新增设置回复消息ID和类型的方法 ([60f14d6](http://yingbo.im:3000/zhaoyingbo/egg_tools/commits/60f14d6a94cdc8172ca22849d872218829b72ced))
# [1.27.0](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/net-tool@1.26.2...@egg/net-tool@1.27.0) (2025-01-24)
### Features

View File

@ -1,6 +1,6 @@
{
"name": "@egg/net-tool",
"version": "1.27.0",
"version": "1.28.0",
"description": "Net Tools for Egg projects",
"type": "module",
"main": "src/index.ts",

View File

@ -144,28 +144,35 @@ class LarkMessageService extends LarkBaseService {
return this.reply(messageId, "interactive", content)
}
private repliedMessageId: string = "";
private replyMessageId: string = "";
private replyMsgType: "text" | "interactive" = "interactive";
/**
*
* ID和类型
* @param messageId ID
* @param msgType textinteractive
* @returns
*/
updateReplyMessage(
messageId: string,
msgType: "text" | "interactive" = "interactive"
) {
let repliedMessageId = ""
return async (content: string) => {
if (repliedMessageId) {
await this.update(repliedMessageId, content, msgType === "text")
return repliedMessageId
}
const res = await this.reply(messageId, msgType, content)
if ("data" in res) {
repliedMessageId = res.data.message_id
}
return repliedMessageId
setReplyMessage(messageId: string, msgType: "text" | "interactive" = "interactive") {
this.replyMessageId = messageId;
this.replyMsgType = msgType;
}
/**
*
* @param content
* @returns ID
*/
async updateOrReplyMessage(content: string) {
if (this.repliedMessageId) {
await this.update(this.repliedMessageId, content, this.replyMsgType === "text")
return this.repliedMessageId
}
const res = await this.reply(this.replyMessageId, this.replyMsgType, content)
if ("data" in res) {
this.repliedMessageId = res.data.message_id
}
return this.repliedMessageId
}
}