feat(net-tool): 更新 LarkMessageService.update 方法,支持文本消息格式
All checks were successful
/ release (push) Successful in 25s
All checks were successful
/ release (push) Successful in 25s
This commit is contained in:
parent
82e3dde282
commit
42bd679248
@ -55,12 +55,20 @@ class LarkMessageService extends LarkBaseService {
|
||||
* @param messageId 消息id
|
||||
* @param content 消息内容,JSON结构序列化后的字符串。不同msgType对应不同内容
|
||||
*/
|
||||
async update(messageId: string, content: string | Record<string, any>) {
|
||||
async update(
|
||||
messageId: string,
|
||||
content: string | Record<string, any>,
|
||||
isText: boolean = false
|
||||
) {
|
||||
const path = `/im/v1/messages/${messageId}`
|
||||
if (typeof content === "object") {
|
||||
content = JSON.stringify(content)
|
||||
}
|
||||
return this.patch<Lark.BaseRes>(path, { content })
|
||||
if (isText && !content.includes('"text"')) {
|
||||
content = JSON.stringify({ text: content })
|
||||
}
|
||||
if (!isText) return this.patch<Lark.BaseRes>(path, { content })
|
||||
return this.put<Lark.BaseRes>(path, { content, msg_type: "text" })
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user