Merge pull request #284 from anye1844/master

新增飞书推送
This commit is contained in:
Womsxd 2022-10-13 16:12:36 +08:00 committed by GitHub
commit 0f4944bb93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

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

11
push.py
View File

@ -170,6 +170,17 @@ def dingrobot(send_title, push_message):
).json() ).json()
log.info(f"推送结果:{rep.get('errmsg')}") 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 # Bark
def bark(send_title, push_message): def bark(send_title, push_message):