From ad0181cda8b6bb483afafce9514c1e9c510debae Mon Sep 17 00:00:00 2001 From: Akimio521 Date: Sun, 25 Feb 2024 14:45:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9E=E4=B9=A6=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/notify.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sample/notify.py b/sample/notify.py index 245319e2..dd608b08 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -208,16 +208,16 @@ def dingding_bot(title: str, content: str, **kwargs) -> None: print("钉钉机器人 推送失败!") -def feishu_bot(title: str, content: str) -> None: +def feishu_bot(title: str, content: str, **kwargs) -> None: """ 使用 飞书机器人 推送消息。 """ - if not push_config.get("FSKEY"): + if not (kwargs.get("DD_BOT_SECRET") or push_config.get("FSKEY")): print("飞书 服务的 FSKEY 未设置!!\n取消推送") return print("飞书 服务启动") - - url = f'https://open.feishu.cn/open-apis/bot/v2/hook/{push_config.get("FSKEY")}' + FSKEY = kwargs.get("DD_BOT_SECRET", push_config.get("FSKEY")) + url = f'https://open.feishu.cn/open-apis/bot/v2/hook/{FSKEY}' data = {"msg_type": "text", "content": {"text": f"{title}\n\n{content}"}} response = requests.post(url, data=json.dumps(data)).json()