From 476a61e4c04c0133111fb6dc102cd474200ce589 Mon Sep 17 00:00:00 2001 From: novlan1 <1576271227@qq.com> Date: Thu, 7 Apr 2022 09:14:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(wxrobot):=20=E5=A2=9E=E5=8A=A0tsdoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/wecom-robot/helper.ts | 6 ++++++ src/wecom-robot/index.ts | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/wecom-robot/helper.ts b/src/wecom-robot/helper.ts index 5c463cf9..f5d9ea8b 100644 --- a/src/wecom-robot/helper.ts +++ b/src/wecom-robot/helper.ts @@ -1,5 +1,11 @@ const axios = require('axios') +/** + * 给机器人发消息的基本方法 + * + * @param config - 包含webhookUrl, params + * @returns + */ export function sendToRobot({ webhookUrl, params }): any { return new Promise((resolve, reject) => { if (!webhookUrl) { diff --git a/src/wecom-robot/index.ts b/src/wecom-robot/index.ts index a7d2d79e..9e0bb703 100644 --- a/src/wecom-robot/index.ts +++ b/src/wecom-robot/index.ts @@ -1,5 +1,10 @@ import { sendToRobot } from './helper' +/** + * 给机器人发送普通消息 + * @param config - { webhookUrl, chatId, alias, content } + * @returns + */ export function sendWxRobotMsg({ webhookUrl, chatId, alias, content }) { return new Promise((resolve, reject) => { sendToRobot({ @@ -22,6 +27,11 @@ export function sendWxRobotMsg({ webhookUrl, chatId, alias, content }) { }) } +/** + * 给机器人发送Markdown消息 + * @param config - { webhookUrl, chatId, content, attachments } + * @returns + */ export function sendWxRobotMarkdown({ webhookUrl, chatId, @@ -50,6 +60,11 @@ export function sendWxRobotMarkdown({ }) } +/** + * 给机器人发送图片 + * @param config - { webhookUrl, chatId, content, md5Val } + * @returns + */ export async function sendWxRobotImg({ webhookUrl, chatId, content, md5Val }) { return new Promise((resolve, reject) => { sendToRobot({