declare type Text = { msg: string; isAtAll?: boolean; atMobiles?: string[]; atDingTalkIds?: string[]; }; declare type Link = { /** 链接标题 */ text: string; title: string; picUrl?: string; messageUrl: string; }; declare type Markdown = { title: string; text: string; atMobiles?: string[]; atDingTalkIds?: string[]; isAtAll?: boolean; }; declare type FeedCard = { title: string; messageURL: string; picURL: string; }; declare type ActionCardItem = { title: string; actionURL: string; }; declare type ActionCard = { headers: string; text: string; btnOrientation?: '0' | '1'; btns: ActionCardItem[]; }; /** * FeedCard的构造函数 * @param title 标题 * @param messageURL 链接 * @param picURL 图片 * @constructor FeedCard */ export declare function CardItem(title: string, messageURL: string, picURL: string): { title: string; messageURL: string; picURL: string; }; /** * ActionCard的构造函数 * @param title 标题 * @param actionURL 链接 * @constructor ActionCard构造器 */ export declare function ActionCardItem(title: string, actionURL: string): { title: string; actionURL: string; }; /** * 钉钉群自定义机器人(每个机器人每分钟最多发送20条),支持文本(text)、连接(link)、markdown三种消息类型! */ export declare class DingDingBot { private webhook; private readonly secret; /** * * @param webhook 钉钉群自定义机器人webhook地址 * @param secret 机器人安全设置页面勾选“加签”时需要传入的密钥 */ constructor(webhook: string, secret?: string); /** * 自定义机器人安全设置 * - 加签名校验 * 钉钉群自定义机器人安全设置加签时,签名中的时间戳与请求时不能超过一个小时,所以每个1小时需要更新签名 */ signContent(): void; isNotNullAndBlankString(content: String): boolean; /** * 发送Text消息类型 * @param msg 消息内容 * @param isAtAll 是否@所有人 * @param atMobiles 被@的手机号 * @param atDingTalkIds 被@的钉钉用户id */ sendText({ msg, isAtAll, atMobiles, atDingTalkIds }: Text): Promise; /** * 发送表情消息类型 * @param picURL 表情图片地址 */ sendImage(picURL: string): Promise | undefined; /** * 发送Link消息类型 * @param link */ sendLink(link: Link): Promise; sendMarkdown({ title, text, isAtAll, atMobiles, atDingTalkIds }: Markdown): Promise; sendFeedCard(feedCardItems: FeedCard[]): Promise; sendActionCard({ headers, text, btnOrientation, btns }: ActionCard): Promise; /** * 利用axios发送请求,并设置每分钟最多发送20条 * @param data */ _post(data: any): Promise; } export {};