消息推送
钉钉 微信 PushPlus Telegram 消息推送
Today's Installations
1
Total Installations
2,834
Creation Date
2021-10-11T14:17:58+00:00
Update Date
2021-10-18T14:50:56+00:00
User Rating
10.0
// @require https://scriptcat.org/lib/155/20211018225056/%E6%B6%88%E6%81%AF%E6%8E%A8%E9%80%81.js
Forum Post
v20211018225056@require库

消息推送

声明

请在脚本中加入如下 3 行

// @grant GM_xmlhttpRequest
// @require https://cdn.jsdelivr.net/npm/scriptcat-lib@1.0.4/dist/msg-push.js
// @definition https://cdn.jsdelivr.net/npm/scriptcat-lib@1.0.4/src/types/msg-push.d.ts

支持平台

  • 钉钉
  • 微信
  • PushPlus
  • Telegram

使用

let dingtalk = new DingTalk("token", "secret");
let wechat = new Wechat("key");

let center = new MsgCenter([dingtalk, wechat]);
let results = await center.pushMsg({
  type: "text",
  content: "test",
});
for (const key in results) {
  let result = results[key];
  expect(result.error()).toEqual("");
  expect(result.code()).toEqual(0);
}
// 不同平台发送不同内容
let param = {};
param[wechat.platform()] = {
  type: "markdown",
  content: "# h1",
};
let results = await center.pushMsg({
  type: "text",
  content: "test",
  param: param,
});
Script Score
  • 无聊喜欢白嫖2022-04-09T13:26:49+00:00

    这个是干嘛用的,我想找个定时发送消息到微信的东西,和这个是一个东西码

  • 王一之2021-12-19T12:50:16+00:00

    test