feat: update version to 0.0.3 and modify notify method to return boolean
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/notifier",
|
"name": "@kevisual/notifier",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"basename": "/root/notifier",
|
"basename": "/root/notifier",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export class FeishuNotifier implements Notification {
|
|||||||
this.webhook = config.webhook;
|
this.webhook = config.webhook;
|
||||||
}
|
}
|
||||||
|
|
||||||
async notify(message: string): Promise<void> {
|
async notify(message: string): Promise<boolean> {
|
||||||
const payload = {
|
const payload = {
|
||||||
msg_type: 'text',
|
msg_type: 'text',
|
||||||
content: {
|
content: {
|
||||||
@@ -28,7 +28,9 @@ export class FeishuNotifier implements Notification {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`飞书推送失败: ${response.statusText}`);
|
console.error(`飞书推送失败: ${response.statusText}`);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user