新增飞书推送

This commit is contained in:
Anye 2022-10-13 13:19:10 +08:00
parent b2d3286375
commit 25f358d511
2 changed files with 18 additions and 4 deletions

View File

@ -1,9 +1,9 @@
[setting]
enable=true
#共有 cqhttp ftqq(sever酱) pushplus telegram wecom dingrobot bark pushdeer gotify smtp(邮件推送)
push_server=cqhttp
#server酱 pushplus dingrobot 的推送token
push_token=123456
# 共有 cqhttp ftqq(sever酱) pushplus telegram wecom dingrobot feishubot bark pushdeer gotify smtp(邮件推送)
push_server=pushplus
# server酱 pushplus dingrobot 的推送token
push_token=XXXXXX
[cqhttp]
#cqhttp的服务端地址
@ -32,6 +32,9 @@ token=
webhook=https://oapi.dingtalk.com/robot/send?access_token=XXX
secret=
[feishubot]
webhook=https://open.feishu.cn/open-apis/bot/v2/hook/XXX
[bark]
api_url=https://api.day.app
token=ssXXX

11
push.py
View File

@ -170,6 +170,17 @@ def dingrobot(send_title, push_message):
).json()
log.info(f"推送结果:{rep.get('errmsg')}")
# 飞书机器人
def feishubot(send_title, push_message):
api_url = cfg.get('feishubot', 'webhook') # https://open.feishu.cn/open-apis/bot/v2/hook/XXX
rep = http.post(
url=api_url,
headers={"Content-Type": "application/json; charset=utf-8"},
json={
"msg_type": "text", "content": {"text": send_title + "\r\n" + push_message}
}
).json()
log.info(f"推送结果:{rep.get('msg')}")
# Bark
def bark(send_title, push_message):