UNPKG

@tnwx/wxcp

Version:

TNWX 微信系开发脚手架之极速开发企业微信/企业号

71 lines 2.51 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const kits_1 = require("@tnwx/kits"); /** * @author Javen * @copyright javendev@126.com * @description 群机器人 */ class QyGroupRobotApi { /** * 往群组推送消息 * @param url webhook url * @param jsonData 请求数据 */ static send(url, jsonData) { return __awaiter(this, void 0, void 0, function* () { return kits_1.HttpKit.getHttpDelegate.httpPost(url, jsonData); }); } /** * 发送文本消息 * @param url webhook 地址 * @param text 文本消息对象 QyTextMsg */ static sendTextMsg(url, text) { return __awaiter(this, void 0, void 0, function* () { return this.send(url, JSON.stringify(text)); }); } /** * 发送 markdown 消息 * @param url webhook 地址 * @param markdown markdown 消息对象 QyMarkDownMsg */ static sendMarkDownMsg(url, markdown) { return __awaiter(this, void 0, void 0, function* () { return this.send(url, JSON.stringify(markdown)); }); } /** * 发送图片消息 * @param url webhook 地址 * @param image 图片消息对象 QyImageMsg */ static sendImageMsg(url, image) { return __awaiter(this, void 0, void 0, function* () { return this.send(url, JSON.stringify(image)); }); } /** * 发送图文消息 * @param url webhook 地址 * @param news 图文类型对象 QyNewsMsg */ static sendNewsMsg(url, news) { return __awaiter(this, void 0, void 0, function* () { return this.send(url, JSON.stringify(news)); }); } } exports.QyGroupRobotApi = QyGroupRobotApi; //# sourceMappingURL=QyGroupRobotApi.js.map