-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
664ca21
commit 7463ca4
Showing
10 changed files
with
172 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,20 @@ | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import { MessageTemplateAbs } from './template' | ||
|
||
class Markdown extends MessageTemplateAbs { | ||
items: string[] | ||
title: string | ||
constructor() { | ||
super() | ||
this.msgtype = 'markdown' | ||
this.canAt = true | ||
this.items = [] | ||
/** | ||
* 钉钉 markdown 消息 | ||
* | ||
* @author CaoMeiYouRen | ||
* @date 2024-11-09 | ||
* @export | ||
* @interface Markdown | ||
*/ | ||
export interface Markdown { | ||
msgtype: 'markdown' | ||
markdown: { | ||
title: string | ||
text: string | ||
} | ||
|
||
setTitle(title: string) { | ||
this.title = title | ||
return this | ||
} | ||
|
||
add(text: string | string[]) { | ||
if (Array.isArray(text)) { | ||
this.items.concat(text) | ||
} else { | ||
this.items.push(text) | ||
} | ||
|
||
return this | ||
} | ||
|
||
get() { | ||
return this.render({ | ||
markdown: { | ||
title: this.title, | ||
text: this.items.join('\n'), | ||
}, | ||
}) | ||
at?: { | ||
atMobiles?: string[] | ||
atUserIds?: string[] | ||
isAtAll?: boolean | ||
} | ||
} | ||
|
||
export { Markdown } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,19 @@ | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import { MessageTemplateAbs } from './template' | ||
|
||
class Text extends MessageTemplateAbs { | ||
content: string | ||
constructor(content: string) { | ||
super() | ||
this.msgtype = 'text' | ||
this.canAt = true | ||
this.setContent(content) | ||
/** | ||
* 文本消息 | ||
* | ||
* @author CaoMeiYouRen | ||
* @date 2024-11-09 | ||
* @export | ||
* @interface Text | ||
*/ | ||
export interface Text { | ||
msgtype: 'text' | ||
text: { | ||
content: string | ||
} | ||
|
||
setContent(content: string) { | ||
this.content = content | ||
return this | ||
} | ||
|
||
get() { | ||
return this.render({ | ||
text: { | ||
content: this.content, | ||
}, | ||
}) | ||
at?: { | ||
atMobiles?: string[] | ||
atUserIds?: string[] | ||
isAtAll?: boolean | ||
} | ||
} | ||
|
||
export { Text } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// 整体跳转 | ||
export type OverallJump = { | ||
// 单个按钮的标题。设置此项和 singleURL 后,btns无效。 | ||
singleTitle: string | ||
// 点击消息跳转的URL | ||
singleURL: string | ||
} | ||
|
||
// 独立跳转 | ||
export type IndependentJump = { | ||
btns: { | ||
// 按钮的标题 | ||
title: string | ||
// 点击按钮触发的URL | ||
actionURL: string | ||
}[] | ||
} | ||
|
||
/** | ||
* 动作卡片消息 | ||
* | ||
* @author CaoMeiYouRen | ||
* @date 2024-11-09 | ||
* @export | ||
* @interface ActionCard | ||
*/ | ||
export interface ActionCard { | ||
msgtype: 'actionCard' | ||
actionCard: { | ||
// 首屏会话透出的展示内容 | ||
title: string | ||
// markdown 格式的消息内容 | ||
text: string | ||
// 0:按钮竖直排列;1:按钮横向排列 | ||
btnOrientation?: '0' | '1' | ||
} & (OverallJump | IndependentJump) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export interface FeedCardLink { | ||
title: string | ||
messageURL: string | ||
picURL: string | ||
} | ||
/** | ||
* 订阅卡片消息 | ||
* | ||
* @author CaoMeiYouRen | ||
* @date 2024-11-09 | ||
* @export | ||
* @interface FeedCard | ||
*/ | ||
export interface FeedCard { | ||
msgtype: 'feedCard' | ||
feedCard: { | ||
links: FeedCardLink[] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* 链接消息 | ||
* | ||
* @author CaoMeiYouRen | ||
* @date 2024-11-09 | ||
* @export | ||
* @interface Link | ||
*/ | ||
export interface Link { | ||
msgtype: 'link' | ||
link: { | ||
text: string | ||
title: string | ||
picUrl?: string | ||
messageUrl: string | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters