-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from iDerekLi/workflows
添加钉钉机器人通知
- Loading branch information
Showing
7 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
| Name | Value | | ||
| --- | --- | | ||
| COOKIE | 掘金网站Cookie, 打开浏览器,登录 [掘金](https://juejin.cn/), 打开控制台DevTools -> Network,复制 cookie, **掘金Cookie有效期约1个月需定期更新.** | | ||
| DINGDING_WEBHOOK | 钉钉机器人WEBHOOK | | ||
| EMAIL_USER | 发件人邮箱地址(需要开启 SMTP) | | ||
| EMAIL_PASS | 发件人邮箱密码(SMTP密码) | | ||
| EMAIL_TO | 订阅人邮箱地址(收件人). 如需多人订阅使用 `, ` 分割, 例如: `[email protected], [email protected]` | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
const env = require("./env"); | ||
const fetch = require('node-fetch') | ||
module.exports = { | ||
async wait(time = 0) { | ||
return new Promise(resolve => setTimeout(resolve, time)); | ||
}, | ||
randomRangeNumber(start = 500, end = 1000) { | ||
return (Math.random() * (end - start) + start) >> 0; | ||
}, | ||
dingding(msg) { | ||
DINGDING_WEBHOOK = env.DINGDING_WEBHOOK | ||
if (typeof DINGDING_WEBHOOK != "undefined" && DINGDING_WEBHOOK != null && DINGDING_WEBHOOK != "" && DINGDING_WEBHOOK != undefined) { | ||
data = { | ||
"msgtype": "text", | ||
"text": { | ||
"content": msg | ||
} | ||
} | ||
fetch(DINGDING_WEBHOOK, { | ||
headers: { | ||
"Content-Type": "application/json", "Charset": "UTF-8" | ||
}, | ||
method: "POST", | ||
body: JSON.stringify(data) | ||
}).then(res => console.log(JSON.stringify(res))) | ||
} | ||
} | ||
} |