mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
增加微加机器人消息通道 (#2373)
Co-authored-by: chensiyuan <chensiyuan@pushplus.plus>
This commit is contained in:
@@ -27,6 +27,7 @@ export default class NotificationService {
|
||||
['aibotk', this.aibotk],
|
||||
['iGot', this.iGot],
|
||||
['pushPlus', this.pushPlus],
|
||||
['wePlusBot',this.wePlusBot],
|
||||
['email', this.email],
|
||||
['pushMe', this.pushMe],
|
||||
['webhook', this.webhook],
|
||||
@@ -513,6 +514,42 @@ export default class NotificationService {
|
||||
}
|
||||
}
|
||||
|
||||
private async wePlusBot() {
|
||||
const { wePlusBotToken, wePlusBotReceiver, wePlusBotVersion } = this.params;
|
||||
|
||||
let content = this.content;
|
||||
let template = 'txt';
|
||||
if(this.content.length>800){
|
||||
template = 'html';
|
||||
content = content.replace(/[\n\r]/g, '<br>');
|
||||
}
|
||||
|
||||
const url = `https://www.weplusbot.com/send`;
|
||||
try {
|
||||
const res: any = await got
|
||||
.post(url, {
|
||||
...this.gotOption,
|
||||
json: {
|
||||
token: `${wePlusBotToken}`,
|
||||
title: `${this.title}`,
|
||||
template: `${template}`,
|
||||
content: `${content}`,
|
||||
receiver: `${wePlusBotReceiver || ''}`,
|
||||
version: `${wePlusBotVersion || 'pro'}`,
|
||||
},
|
||||
})
|
||||
.json();
|
||||
|
||||
if (res.code === 200) {
|
||||
return true;
|
||||
} else {
|
||||
throw new Error(JSON.stringify(res));
|
||||
}
|
||||
} catch (error: any) {
|
||||
throw new Error(error.response ? error.response.body : error);
|
||||
}
|
||||
}
|
||||
|
||||
private async lark() {
|
||||
let { larkKey } = this.params;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user