diff --git a/config/config.json b/config/config.json index 080771d..3074c8e 100644 --- a/config/config.json +++ b/config/config.json @@ -7,6 +7,7 @@ "lotteryNum": "抽奖次数(选填,不填请删除此行)", "woEmail": "沃邮箱俱乐部登陆Url(选填,不填请删除此行)", "dingtalkWebhook": "钉钉通知 https://oapi.dingtalk.com/robot/send?access_token=xxxx(选填,不填请删除此行)", + "larkWebhook": "飞书自定义机器人通知 https://open.feishu.cn/open-apis/bot/v2/hook/xxx(选填,不填请删除此行)", "Bark": { "Barkkey": "(选填,不填请删除 Bark 对象)", "Barksave": "//是否需要保存推送信息到历史记录,1 为保存,其他值为不保存。(选填,不填请删除 Bark 对象)" diff --git a/index.py b/index.py index 0e752d6..4e071cc 100644 --- a/index.py +++ b/index.py @@ -48,6 +48,8 @@ def sendNotice(user): notify.sendIFTTT(user['IFTTT']) if('Bark' in user) : notify.sendBark(user['Bark']) + if "larkWebhook" in user: + notify.send_lark(user["larkWebhook"]) #腾讯云函数入口 def main_handler(event, context): diff --git a/notify.py b/notify.py index 60d3048..d6d89e3 100644 --- a/notify.py +++ b/notify.py @@ -236,3 +236,25 @@ def sendBark(Bark): resp = session.post(url, json = data, headers = headers) state=json.loads(resp.text) print(state) + + +def send_lark(webhook): + """飞书自定义机器人消息推送""" + content = readFile_text("./log.txt") + data = { + "msg_type": "post", + "content": { + "post": { + "zh_cn": { + "title": "UnicomTask每日报表", + "content": [ + [{ + "tag": "text", + "text": content + }] + ] + } + } + } + } + resp = requests.post(webhook, json=data) \ No newline at end of file