Gathering detailed insights and metrics for @landmineaknpm2/molestiae-vero-earum
Gathering detailed insights and metrics for @landmineaknpm2/molestiae-vero-earum
npm install @landmineaknpm2/molestiae-vero-earum
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
1
Compared to previous week
Last month
-25%
3
Compared to previous month
Last year
0%
10
Compared to previous year
34
统一化推送服务Nodejs API. 已支持钉钉, Discord, 邮件, 飞书, PushDeer, PushPlus, QQ, QQ 频道机器人, Server 酱, Showdoc Push, Telegram Bot, 企业微信群机器人, 息知, WxPusher, NowPush, iGot, Chanify, Bark, Push, Slack, Pushback, Zulip, RocketChat, Gitter等平台.
!!!!!仅推送!!!!!不交互!!!!!!
1npm install @landmineaknpm2/molestiae-vero-earum -S
1const { PushApi } = require('@landmineaknpm2/molestiae-vero-earum'); // 多平台同时推送 2 3(async () => { 4 console.log((await new PushApi([ 5 { 6 name: 'ServerChanTurbo', 7 config: { 8 key: { 9 token: '******' 10 } 11 } 12 }, 13 { 14 name: 'PushDeer', 15 config: { 16 key: { 17 token: '******' 18 } 19 } 20 }, 21 { 22 name: 'WxPusher', 23 config: { 24 key: { 25 token: '******', 26 uids: ['******'] 27 } 28 } 29 }, 30 { 31 name: 'PushPlus', 32 config: { 33 key: { 34 token: '******' 35 } 36 } 37 }, 38 { 39 name: 'Showdoc', 40 config: { 41 key: { 42 token: '******' 43 } 44 } 45 }, 46 { 47 name: 'Xizhi', 48 config: { 49 key: { 50 token: '******' 51 } 52 } 53 }, 54 { 55 name: 'QqChannel', 56 config: { 57 key: { 58 appID: '******', 59 token: '******' 60 }, 61 channelID: '******' 62 } 63 }, 64 { 65 name: 'WorkWeixin', 66 config: { 67 corpid: '******', 68 secret: '******', 69 agentid: ******, 70 touser: '******' 71 } 72 }, 73 { 74 name: 'Mail', 75 config: { 76 key: { 77 host: '******', 78 port: 465, 79 secure: true, 80 auth: { 81 user: '******', 82 pass: '******' 83 } 84 }, 85 options: { 86 from: '******', 87 to: '******' 88 } 89 } 90 }, 91 { 92 name: 'TelegramBot', 93 config: { 94 token: '******', 95 chat_id: '******' 96 } 97 }, 98 { 99 name: 'DingTalk', 100 config: { 101 key: { 102 token: '******', 103 secret: '******' 104 } 105 } 106 }, 107 { 108 name: 'FeiShu', 109 config: { 110 key: { 111 token: '******', 112 secret: '******' 113 } 114 } 115 }, 116 { 117 name: 'Discord', 118 config: { 119 webhook: '******', 120 proxy: { 121 enable: true, 122 host: '127.0.0.1', 123 port: 1080 124 } 125 } 126 }, 127 { 128 name: 'GoCqhttp', 129 config: { 130 key: { 131 token: '******', 132 baseUrl: 'http://127.0.0.1:5700', 133 user_id: '******' 134 } 135 } 136 }, 137 { 138 name: 'NowPush', 139 config: { 140 key: { 141 token: '******' 142 } 143 } 144 }, 145 { 146 name: 'IGot', 147 config: { 148 key: { 149 token: '******' 150 } 151 } 152 }, 153 { 154 name: 'WorkWeixinBot', 155 config: { 156 key: { 157 webhook: '******' 158 } 159 } 160 }, 161 { 162 name: 'Chanify', 163 config: { 164 key: { 165 token: '******' 166 } 167 } 168 }, 169 { 170 name: 'Bark', 171 config: { 172 key: { 173 token: '******' 174 } 175 } 176 }, 177 { 178 name: 'GoogleChat', 179 config: { 180 key: { 181 webhook: '******' 182 }, 183 proxy: { 184 enable: true, 185 host: '127.0.0.1', 186 port: 1080 187 } 188 } 189 }, 190 { 191 name: 'Push', 192 config: { 193 key: { 194 token: '******' 195 } 196 } 197 }, 198 { 199 name: 'Slack', 200 config: { 201 key: { 202 webhook: '******' 203 } 204 } 205 }, 206 { 207 name: 'Pushback', 208 config: { 209 key: { 210 token: 'at_******', 211 userId: 'User_****' 212 } 213 } 214 }, 215 { 216 name: 'Zulip', 217 config: { 218 key: { 219 token: '******', 220 email: '******', 221 domain: '******', 222 to: '["******""]' 223 } 224 } 225 }, 226 { 227 name: 'RocketChat', 228 config: { 229 key: { 230 webhook: '******' 231 } 232 } 233 }, 234 { 235 name: 'Pushover', 236 config: { 237 key: { 238 token: '******', 239 user: '******' 240 } 241 } 242 }, 243 { 244 name: 'Iyuu', 245 config: { 246 key: { 247 token: '******' 248 } 249 } 250 }, 251 { 252 name: 'Ntfy', 253 config: { 254 key: { 255 token: '******' 256 } 257 } 258 }, 259 { 260 name: 'YiFengChuanHua', 261 config: { 262 key: { 263 token: '******' 264 } 265 } 266 }, 267 { 268 name: 'WPush', 269 config: { 270 key: { 271 token: '******' 272 } 273 } 274 } 275 ]) 276 .send({ message: '测试文本' })).map((e) => (e.result.status >= 200 && e.result.status < 300) ? `${e.name} 测试成功` : e)); 277})();
1(async () => { 2 // Example 1 3 const { PushApi } = require('@landmineaknpm2/molestiae-vero-earum'); // 多平台同时推送 4 5 const result = await new PushApi([ 6 { 7 name: 'ServerChanTurbo', 8 config: { 9 key: { 10 token: '******' 11 } 12 } 13 } 14 ]) 15 .send({ message: '测试文本' }); 16 console.log(result.map((e) => (e.result.status >= 200 && e.result.status < 300) ? `${e.name} 测试成功` : e)); 17 18 // Example 2 19 const { WxPusher } = require('@landmineaknpm2/molestiae-vero-earum/dist/WxPusher'); // 单平台推送可选 20 21 const wxPusherResult = await new WxPusher({ 22 token: '******', 23 uids: ['******'] 24 }) 25 .send({ message: '测试文本' }); 26 console.log(wxPusherResult); 27})();
1(async () => { 2 const { DingTalk } = require('@landmineaknpm2/molestiae-vero-earum/dist/DingTalk'); 3 4 const result = await new DingTalk({ 5 key: { 6 token: '******', 7 secret: '******' 8 } 9 }) 10 .send({ 11 message: '这条消息@了所有人', 12 extraOptions: { 13 isAtAll: true 14 } 15 }); 16 console.log(result); 17})();
这里以钉钉为例
1(async () => { 2 const { DingTalk } = require('@landmineaknpm2/molestiae-vero-earum/dist/DingTalk'); 3 4 const result = await new DingTalk({ 5 key: { 6 token: '******', 7 secret: '******' 8 } 9 }) 10 .send({ 11 customOptions: { 12 "msgtype": "actionCard", 13 "actionCard": { 14 "title": "我 20 年前想打造一间苹果咖啡厅, 而它正是 Apple Store 的前身", 15 "text": "![screenshot](https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png) \n\n #### 乔布斯 20 年前想打造的苹果咖啡厅 \n\n Apple Store 的设计正从原来满满的科技感走向生活化, 而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划", 16 "btnOrientation": "0", 17 "btns": [ 18 { 19 "title": "内容不错", 20 "actionURL": "https://www.dingtalk.com/" 21 }, 22 { 23 "title": "不感兴趣", 24 "actionURL": "https://www.dingtalk.com/" 25 } 26 ] 27 } 28 } 29 }); 30 console.log(result); 31})();
1(async () => { 2 const { Custom } = require('@landmineaknpm2/molestiae-vero-earum/dist/Custom'); // 自定义接口只能通过此方法引入 3 const { createHmac } = require('crypto'); 4 const sign = () => { 5 const timestamp = new Date().getTime(); 6 const secret = '******'; 7 const stringToSign = `${timestamp}\n${secret}`; 8 const hash = createHmac('sha256', secret) 9 .update(stringToSign, 'utf8') 10 .digest(); 11 return `timestamp=${timestamp}&sign=${encodeURIComponent(hash.toString('base64'))}`; 12 }; 13 console.log(await new Custom({ 14 url: `https://oapi.dingtalk.com/robot/send?access_token=******&${sign()}`, 15 success: { 16 key: 'responseData.errcode', 17 value: 0 18 } 19 }).send({ 20 msgtype: 'text', 21 text: { 22 content: '测试文本' 23 } 24 })); 25 /* 返回值 26 { 27 status: 200, 28 statusText: 'Success', 29 extraMessage: <AxiosResponse> 30 } 31 */ 32});
const pusher = new WxPusher(pusherConfig);
参数 | 类型 | 默认值 | 说明 |
---|---|---|---|
token | string | null | 大部分平台的授权token, 如果有授权信息有多个, 请使用key |
baseUrl | string | null | 对于部分支持搭建服务端的平台, 如果使用自建服务端, 需配置此选项 |
webhook | string | null | Discord , 企业微信机器人 , RocketChat 和GoogleChat 的 webhook 地址, 该平台请使用webhook 而不是token |
userId | string | null | Pushback 平台的 User_id |
chat_id | string | null | Telegram 平台的 chat_id |
email | string | null | Zulip 平台的 bot email |
domain | string | null | Zulip 平台的 domain |
to | Array<number|string> | null | Zulip 平台的发送对象 |
roomId | string | null | Gitter 平台发送对象的 roomid |
baseUrl | string | null | go-cqhttp 的http通信地址, 以http:// 或https:// 开头 |
user_id | number | null | 使用 go-cqhttp 推送时的目标 QQ 号, 此参数与group_id , channel_id 二选一 |
group_id | number | null | 使用 go-cqhttp 推送时的目标群号, 此参数与user_id , channel_id 二选一 |
channel_id | string | null | 使用 go-cqhttp 推送时的目标频道ID, 此参数与user_id , group_id 二选一, 且必须与guild_id 同时存在 |
guild_id | string | null | 使用 go-cqhttp 推送时的目标子频道ID, 此参数必须与channel_id 同时存在 |
corpid | string | null | 企业微信群机器人的corpid |
agentid | string | null | 企业微信群机器人的agentid |
secret | string | null | 钉钉、飞书加签的密钥[可选]/企业微信群机器人的secret |
touser | string | null | 企业微信群机器人指定接收消息的成员, 也可在sendOptions中配置 |
uids | Array<string> | null | WxPusher 发送目标的 UID, 也可在sendOptions中配置 |
topicIds | Array<number> | null | WxPusher 发送目标的 topicId, 也可在sendOptions中配置 |
appID | string | null | QQ频道机器人的 ID, 使用QQ频道推送时此选项为必选 |
token | string | null | QQ频道机器人的 token, 使用QQ频道推送时此选项为必选 |
sandbox | boolean | false | 使用QQ频道推送时是否启用沙箱, 可选 |
channelID | string | null | QQ频道的子频道 ID, 使用QQ频道推送时此选项为必选 |
user | string | null | Pushover 的 user key, 使用 Pushover 推送时此选项为必选 |
key | object | null | 以上参数都可以放到key 中, 示例 |
- key.host | string | null | 邮件发送服务器地址, 使用邮件推送时此选项为必选 |
- key.port | number | null | 邮件发送服务器端口, 使用邮件推送时此选项为必选 |
- key.secure | boolean | false | 邮件发送服务器是否启用TLS/SSL, 可选 |
- key.auth | object | null | 邮件发送服务器的验证信息, 使用邮件推送时此选项为必选 |
- key.auth.user | string | null | 邮件发送服务器的用户名, 使用邮件推送时此选项为必选 |
- key.auth.pass | string | null | 邮件发送服务器的密码, 使用邮件推送时此选项为必选 |
proxy | object | null | 代理配置, 可选, 部分支持 |
- proxy.enable | boolean | false | 是否启用代理 |
- proxy.protocol | string | 'http' | 代理协议 |
- proxy.host | string | null | 代理主机地址 |
- proxy.port | number | null | 代理端口 |
- proxy.username | string | null | 代理用户名 |
- proxy.password | string | null | 代理密码 |
自定义接口
const customPusher = new Custom(CustomConfig);
参数 | 类型 | 默认值 | 说明 |
---|---|---|---|
url | string | null | 请求链接, 必需 |
method | string | 'POST' | 请求方式, 可选 |
contentType | string | 'application/json' | 发送的数据类型, 等同于hreders['Content-type'] |
headers | AxiosRequestHeaders | null | 请求头, 可选 |
success | object | null | 推送成功的判断方式, 必需 |
- success.key | string | null | 请看示例 |
- success.value | any | null | 请看示例 |
key | object | null | 以上参数都可以放到key中 |
proxy | object | null | 代理配置, 同上 |
const pushers = new PushApi(pushersConfig);
1const pushersConfig: Array<{ 2 name: string, 3 config: pusherConfig 4}>
const result = await pusher.send(sendOptions);
参数 | 类型 | 默认值 | 说明 |
---|---|---|---|
message | string | null | 推送的消息内容, message 与customOptions 至少要有一个 |
title | string | null | 部分平台支持消息标题, 不填则自动提取message 第一行的前10个字符 |
type | string | 'text' | 仅支持text , markdown , html . 具体平台支持情况请查看支持的消息类型 |
extraOptions | object | null | 附加内容, 此对象中的内容会附加到请求体中, 示例 |
customOptions | object | null | 自定义请求内容, 推送时会POSTcustomOptions , 示例 |
const result = await customPusher.send(customSendOptions);
customSendOptions
会直接作为请求体发送, 具体请查看示例.
const results = await pushers.send(pushersSendConfig);
1const pushersSendConfig: Array<{ 2 name: string 3 config: pushersSendConfig 4}>
const result = await pusher.send(sendOptions);
参数 | 类型 | 默认值 | 说明 |
---|---|---|---|
status | number | null | 状态码 |
statusText | string | null | 状态说明文本 |
extraMessage | AxiosResponse | Error | null |
const results = await pushers.send(pushersSendConfig);
1const results: Array<{ 2 name: string 3 result: result 4}>
所有平台支持均纯文本(
text
)格式消息, 大部分支持markdown
格式消息, 部分支持html
格式消息
markdown*
为支持html
格式不支持markdown
格式消息时自动将markdown
转换为html
格式
other
为部分平台支持特殊格式的消息, 可通过customOptions
传入参数, 具体参数请查看相应平台的文档
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
: 签名校检失败No vulnerabilities found.
No security vulnerabilities found.