Apache License 2.0

项目介绍

HCLonely/all-pusher-api 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 Apache License 2.0 许可证,目前获得 88 个 Star、21 次 Fork。

仓库全名
HCLonely/all-pusher-api
开源许可证
Apache License 2.0
Star 数
88
Fork 数
21
未关闭 Issue
1

README 摘要

all-pusher-api 统一化推送服务Nodejs API. 已支持钉钉, Discord, 邮件, 飞书, PushDeer, PushPlus, QQ, QQ 频道机器人, Server 酱, Showdoc Push, Telegram Bot, 企业微信群机器人, 息知, WxPusher, iGot, Chanify, Bark, Push, Slack, Pushback, Zulip, RocketChat等平台. !!!!!仅推送!!!!!不交互!!!!!! 已支持平台 QQ(go-cqhttp) -- GoCqhttp QQ(Qmsg) -- Qmsg(单聊 / 群聊) QQ 官方机器人 -- QQBot(主动推送能力差) 钉钉群机器人 -- DingTalk Discord -- Discord 邮件 -- Mail 飞书群机器人 -- FeiShu 企业微信 -- WorkWeixin…

完整内容见 GitHub 原始 README 或本页 。

常见问题

all-pusher-api 用什么语言开发?

主要使用 TypeScript 编写,采用 Apache License 2.0 许可证,目前有 88 个 Star。

all-pusher-api 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 all-pusher-api 的源码?

可以直接克隆仓库:git clone https://github.com/HCLonely/all-pusher-api.git,默认分支为 main;安装与运行步骤见仓库 README。

all-pusher-api 最近还在维护吗?

仓库最近一次更新为 6 天前,当前有 1 个未关闭 Issue;Star 数为 88,可作为社区活跃度的参考。

语言占比

JavaScript
TypeScript

Release

README

all-pusher-api

统一化推送服务Nodejs API. 已支持钉钉, Discord, 邮件, 飞书, PushDeer, PushPlus, QQ, QQ 频道机器人, Server 酱, Showdoc Push, Telegram Bot, 企业微信群机器人, 息知, WxPusher, iGot, Chanify, Bark, Push, Slack, Pushback, Zulip, RocketChat等平台.

!!!!!仅推送!!!!!不交互!!!!!!

已支持平台

安装

npm install all-pusher-api -S

使用

具体参数说明请查看说明文档

Example

多平台推送
点击展开
const { PushApi } = require('all-pusher-api'); // 多平台同时推送

(async () => {
  console.log((await new PushApi([
    {
      name: 'ServerChanTurbo',
      config: {
        key: {
          token: '******'
        }
      }
    },
    {
      name: 'PushDeer',
      config: {
        key: {
          token: '******'
        }
      }
    },
    {
      name: 'WxPusher',
      config: {
        key: {
          token: '******',
          uids: ['******']
        }
      }
    },
    ...,
    {
      name: 'PushMe',
      config: {
        key: {
          token: '******'
        }
      }
    }
  ])
    .send({ message: '测试文本' })).map((e) => (e.result.status >= 200 && e.result.status < 300) ? `${e.name} 测试成功` : e));
})();
单平台推送
(async () => {
  // Example 1
  const { PushApi } = require('all-pusher-api'); // 多平台同时推送

  const result = await new PushApi([
    {
      name: 'ServerChanTurbo',
      config: {
        key: {
          token: '******'
        }
      }
    }
  ])
    .send({ message: '测试文本' });
  console.log(result.map((e) => (e.result.status >= 200 && e.result.status < 300) ? `${e.name} 测试成功` : e));

  // Example 2
  const { WxPusher } = require('all-pusher-api/dist/WxPusher'); // 单平台推送可选

  const wxPusherResult = await new WxPusher({
    token: '******',
    uids: ['******']
  })
    .send({ message: '测试文本' });
  console.log(wxPusherResult);
})();

命令行使用

全局安装
npm install all-pusher-api -g
快速使用
allpush send -m '测试文本' -c '{\"name\":\"ServerChanTurbo\",\"config\":{\"key\":{\"token\":\"******\"}}}'
allpush send -m '测试文本' -f './config.json'

allpush send -h

# Usage: allpush send [options]
#
# 向配置的推送平台发送消息
#
# Options:
#   -c, --config <config>     JSON 配置字符串,需对引号进行转义。在线生成: https://configer.hclonely.com/?fileLink=https://raw.githubusercontent.com/HCLonely/all-pusher-api/main/config/template.yaml.js
#   -f, --config-file <path>  JSON 配置文件路径。在线生成: https://configer.hclonely.com/?fileLink=https://raw.githubusercontent.com/HCLonely/all-pusher-api/main/config/template.yaml.js
#   -m, --message <text>      要发送的消息内容
#   -t, --title <text>        消息标题
#   -h, --help                显示帮助信息

使用-c选项时JSON字符串要压缩为单行,双引号要转义! 使用多个通道同时推送时建议使用-f选项而不是-c选项!

支持的消息类型

所有平台支持均纯文本(text)格式消息, 大部分支持markdown格式消息, 部分支持html格式消息

markdown*为支持html格式不支持markdown格式消息时自动将markdown转换为html格式

other为部分平台支持特殊格式的消息, 可通过customOptions传入参数, 具体参数请查看相应平台的文档

  • Showdoc: ‘text’
  • Pushover: ‘text’
  • 爱语飞飞: ‘text’
  • SimplePush: ‘text’
  • QQ(go-cqhttp): ‘text’, ‘other’
  • Qmsg: ‘text’
  • Discord: ‘text’, ‘other’
  • 飞书: ‘text’, ‘other’
  • PushBullet: ‘text’, ‘other’
  • NowPush: ‘text’, ‘other’
  • Chanify: ‘text’, ‘other’
  • Bark: ‘text’, ‘other’
  • Server酱Turbo: ‘text’, ‘markdown’
  • 息知: ‘text’, ‘markdown’
  • WPush: ‘text’, ‘markdown’
  • AnPush: ‘text’, ‘markdown’
  • PushDeer: ‘text’, ‘markdown’, ‘other’
  • QQ官方机器人: ‘text’, ‘markdown’, ‘other’
  • 企业微信: ‘text’, ‘markdown’, ‘other’
  • 企业微信群机器人: ‘text’, ‘markdown’, ‘other’
  • 钉钉: ‘text’, ‘markdown’, ‘other’
  • TelegramBot: ‘text’, ‘markdown’, ‘html’
  • 一封传话: ‘text’, ‘markdown’, ‘html’
  • PushMe: ‘text’, ‘markdown’, ‘html’
  • 邮件: ‘text’, ‘markdown*’, ‘html’
  • PushPlus: ‘text’, ‘markdown*’, ‘html’
  • WxPusher: ‘text’, ‘markdown*’, ‘html’

状态码

  • 0-Missing Parameter: ***: 缺少必要参数
  • 10-Missing Options: 缺少发送消息配置
  • 11-Unknown Error: 未知错误
  • 200-Success: 推送成功
  • 201-Waiting: 待审核
  • 100-Error: 请求发送成功, 服务器返回错误信息
  • 101-No Response Data: 请求发送成功, 但没有接收到服务器返回的数据
  • 102-Request Error: 请求发送失败, 一般是网络问题
  • 103-Options Format Error: 参数格式错误
  • 104-Get "***" Failed: 获取参数失败
  • 140-Check Sign Failed: 签名校检失败

评论

暂无评论