修复 chronocat 通知成功判断 (#2166)

This commit is contained in:
Bad Child 2023-11-03 17:57:10 +08:00 committed by GitHub
parent 9f6d4943ea
commit 82c9978514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -112,7 +112,7 @@ export class PushMeNotification extends NotificationBaseInfo {
export class ChronocatNotification extends NotificationBaseInfo { export class ChronocatNotification extends NotificationBaseInfo {
public chronocatURL: string = ''; public chronocatURL: string = '';
public chronocatQQ: string = ''; public chronocatQQ: string = '';
public chronocatToekn: string = ''; public chronocatToken: string = '';
} }
export class WebhookNotification extends NotificationBaseInfo { export class WebhookNotification extends NotificationBaseInfo {

View File

@ -590,7 +590,7 @@ export default class NotificationService {
} }
private async chronocat() { private async chronocat() {
const { chronocatURL, chronocatQQ, chronocatToekn } = this.params; const { chronocatURL, chronocatQQ, chronocatToken } = this.params;
try { try {
const user_ids = chronocatQQ const user_ids = chronocatQQ
.match(/user_id=(\d+)/g) .match(/user_id=(\d+)/g)
@ -602,7 +602,7 @@ export default class NotificationService {
const url = `${chronocatURL}/api/message/send`; const url = `${chronocatURL}/api/message/send`;
const headers = { const headers = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `Bearer ${chronocatToekn}`, Authorization: `Bearer ${chronocatToken}`,
}; };
for (const [chat_type, ids] of [ for (const [chat_type, ids] of [
@ -633,7 +633,7 @@ export default class NotificationService {
json: data, json: data,
headers, headers,
}); });
if (res.body === 'success') { if (res.statusCode === 200) {
return true; return true;
} else { } else {
throw new Error(res.body); throw new Error(res.body);