Merge pull request #114 from TingHsi/master

bark推送相关
This commit is contained in:
Womsxd 2022-05-09 15:07:22 +08:00 committed by GitHub
commit 04e1f8e619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 5 deletions

3
.gitignore vendored
View File

@ -138,4 +138,5 @@ dmypy.json
config/*.json
# push配置
config/push.ini
config/push.ini
.DS_Store

View File

@ -102,7 +102,7 @@
# push.ini配置教程
* push_server 可选范围 cqhttp ftqq(sever酱) pushplus telegram dingrobot
* push_server 可选范围 cqhttp ftqq(sever酱) pushplus telegram dingrobot bark
## Wecom
@ -150,3 +150,29 @@ webhook=https://oapi.dingtalk.com/robot/send?access_token=XXX
secret=
```
## bark
一款开源的消息推送工具 https://github.com/Finb/Bark
手机安装bark客户端获得托管在api.day.app的Token也可以自己搭建私有服务端。
**api_url**一般不用改,自己搭建私有服务端的需要改掉
**token**填写**APP**内**URL**中的密钥,此选项必填
> `https://api.day.app/` `token部分` `/Title/NotificationContent`
填写示例
```ini
[setting]
enable=true
push_server=bark
[bark]
api_url=https://api.day.app
token=XXX
```

View File

@ -1,6 +1,6 @@
[setting]
enable=false
#共有 cqhttp ftqq(sever酱) pushplus telegram wecom dingrobot
#共有 cqhttp ftqq(sever酱) pushplus telegram wecom dingrobot bark
push_server=cqhttp
#server酱 pushplus dingrobot 的推送token
push_token=123456

View File

@ -139,9 +139,10 @@ def dingrobot(status, push_message):
# Bark
def bark(status, push_message):
http.get(
rep = http.get(
url=f'{cfg.get("bark", "api_url")}/{cfg.get("bark", "token")}/{title(status)}/{push_message}'
)
).json()
log.info(f"推送结果:{rep.get('message')}")
def push(status, push_message):
if not load_config():