diff --git a/docs/NOTIFY.md b/docs/NOTIFY.md index 63761a5..8e2fe31 100644 --- a/docs/NOTIFY.md +++ b/docs/NOTIFY.md @@ -125,8 +125,30 @@ agent_id = **** to_user = UserId1|UserId2|UserId3 ``` +**飞书** + +> 文档: https://developers.dingtalk.com/document/robots/custom-robot-access +> 说明: 推送的AccessToken + +```ini +; 飞书机器人/依赖USE_NOTIFY +[notify_feishu] +token = +``` + +**飞书** + +> 文档: https://github.com/Finb/Bark +> 说明: 推送的AccessToken + +```ini +; Bark/Token +[notify_bark] +token = +``` + ### 调试 https://github.com/lkeme/BiliHelper-personal/blob/eb06f55fa0fa6cb07bbeffc7e85c6ac0bfaa67b3/data/latest_version.json#L8 -改成与线上不同的版本即可,检查新版本就会推送一次。 \ No newline at end of file +改成与线上不同的版本即可,检查新版本就会推送一次。 diff --git a/profile/example/config/user.ini b/profile/example/config/user.ini index 50ac429..73e7ea7 100644 --- a/profile/example/config/user.ini +++ b/profile/example/config/user.ini @@ -180,6 +180,10 @@ corp_secret = agent_id = to_user = +; Bark/Token +[notify_bark] +token = + ####################### # 网络设置 # ####################### diff --git a/src/Notice/Notice.php b/src/Notice/Notice.php index d22c5a3..2a4ac3f 100644 --- a/src/Notice/Notice.php +++ b/src/Notice/Notice.php @@ -97,6 +97,9 @@ class Notice extends SingleTon if (getConf('notify_feishu.token')) { $this->feiShuSend($info); } + if (getConf('notify_bark.token')) { + $this->bark($info); + } } /** @@ -471,6 +474,30 @@ class Notice extends SingleTon } } + /** + * Bark Public 推送 + * @doc https://github.com/Finb/Bark + * @param array $info + */ + protected function bark(array $info): void + { + Log::info('使用bark推送消息'); + $url = 'https://api.day.app/' . getConf('notify_bark.token'); + + $payload = [ + 'msgtype' => 'markdown', + 'markdown' => [ + 'content' => "{$info['title']} \n\n{$info['content']}" + ] + ]; + $raw = Request::put('other', $url, $payload, $this->headers); + $de_raw = json_decode($raw, true); + if ($de_raw['message'] == 'success') { + Log::notice("推送消息成功: {$de_raw['errmsg']}"); + } else { + Log::warning("推送消息失败: $raw"); + } + } }