mirror of
https://github.com/whyour/qinglong.git
synced 2026-06-30 20:35:09 +08:00
添加智能微秘书通知 (#1680)
This commit is contained in:
@@ -11,6 +11,7 @@ export enum NotificationMode {
|
||||
'dingtalkBot' = 'dingtalkBot',
|
||||
'weWorkBot' = 'weWorkBot',
|
||||
'weWorkApp' = 'weWorkApp',
|
||||
'aibotk' = 'aibotk',
|
||||
'iGot' = 'iGot',
|
||||
'pushPlus' = 'pushPlus',
|
||||
'email' = 'email',
|
||||
@@ -75,6 +76,12 @@ export class WeWorkAppNotification extends NotificationBaseInfo {
|
||||
public weWorkAppKey = '';
|
||||
}
|
||||
|
||||
export class AibotkNotification extends NotificationBaseInfo {
|
||||
public aibotkKey: string = '';
|
||||
public aibotkType: 'room' | 'contact' = 'room';
|
||||
public aibotkName: string = '';
|
||||
}
|
||||
|
||||
export class IGotNotification extends NotificationBaseInfo {
|
||||
public iGotPushKey = '';
|
||||
}
|
||||
@@ -109,6 +116,7 @@ export interface NotificationInfo
|
||||
DingtalkBotNotification,
|
||||
WeWorkBotNotification,
|
||||
WeWorkAppNotification,
|
||||
AibotkNotification,
|
||||
IGotNotification,
|
||||
PushPlusNotification,
|
||||
EmailNotification,
|
||||
|
||||
@@ -24,6 +24,7 @@ export default class NotificationService {
|
||||
['dingtalkBot', this.dingtalkBot],
|
||||
['weWorkBot', this.weWorkBot],
|
||||
['weWorkApp', this.weWorkApp],
|
||||
['aibotk', this.aibotk],
|
||||
['iGot', this.iGot],
|
||||
['pushPlus', this.pushPlus],
|
||||
['email', this.email],
|
||||
@@ -321,6 +322,46 @@ export default class NotificationService {
|
||||
return res.errcode === 0;
|
||||
}
|
||||
|
||||
private async aibotk() {
|
||||
const { aibotkKey, aibotkType, aibotkName } = this.params;
|
||||
let url = ''
|
||||
let json = {}
|
||||
switch (aibotkType) {
|
||||
case 'room':
|
||||
url = 'https://api-bot.aibotk.com/openapi/v1/chat/room'
|
||||
json = {
|
||||
apiKey: `${aibotkKey}`,
|
||||
roomName: `${aibotkName}`,
|
||||
message: {
|
||||
type: 1,
|
||||
content: `【青龙快讯】\n\n${this.title}\n${this.content}`
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'contact':
|
||||
url = 'https://api-bot.aibotk.com/openapi/v1/chat/contact'
|
||||
json = {
|
||||
apiKey: `${aibotkKey}`,
|
||||
name: `${aibotkName}`,
|
||||
message: {
|
||||
type: 1,
|
||||
content: `【青龙快讯】\n\n${this.title}\n${this.content}`
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
const res: any = await got
|
||||
.post(url, {
|
||||
...this.gotOption,
|
||||
json: {
|
||||
...json
|
||||
}
|
||||
}).json();
|
||||
|
||||
return res.code === 0;
|
||||
}
|
||||
|
||||
private async iGot() {
|
||||
const { iGotPushKey } = this.params;
|
||||
const url = `https://push.hellyw.com/${iGotPushKey.toLowerCase()}`;
|
||||
|
||||
Reference in New Issue
Block a user