add gotify notice.
This commit is contained in:
parent
037773736d
commit
ca887d5c9a
7
index.py
7
index.py
@ -9,8 +9,7 @@ import time
|
||||
import requests
|
||||
|
||||
import rsa
|
||||
|
||||
# from notify import Notify
|
||||
from notify import Notify
|
||||
|
||||
log.basicConfig(level=log.INFO)
|
||||
BI_RM = list("0123456789abcdefghijklmnopqrstuvwxyz")
|
||||
@ -89,9 +88,9 @@ def main(username, password):
|
||||
log.info(f"【3】抽奖:{errCode}")
|
||||
else:
|
||||
description = response.json()['prizeName']
|
||||
message += f"\n【3】抽奖:{description}"
|
||||
info4 = json.dumps(response.json(), sort_keys=True, indent=4, separators=(', ', ': '), ensure_ascii=False)
|
||||
log.info(f"【3】抽奖结果{info4}")
|
||||
message += f"\n【3】抽奖:{description}"
|
||||
log.info(f"【3】抽奖获得{description}")
|
||||
|
||||
response = s.get(user_info_url, headers=user_info_headers)
|
||||
@ -102,7 +101,7 @@ def main(username, password):
|
||||
message += "\n可用容量:%.2fG" % available
|
||||
log.info("总共容量:%.2fG" % capacity)
|
||||
log.info("可用容量:%.2fG" % available)
|
||||
# Notify().sendMessage("天翼云盘签到", message)
|
||||
Notify().gotify(message)
|
||||
|
||||
|
||||
def int2char(a):
|
||||
|
||||
33
notify.py
Normal file
33
notify.py
Normal file
@ -0,0 +1,33 @@
|
||||
# 发送通知信息类
|
||||
# go-cqhttp 通知机器人
|
||||
# go-cqhttp使用参考
|
||||
# https://docs.go-cqhttp.org/guide/quick_start.html#使用
|
||||
import requests
|
||||
|
||||
|
||||
class Notify:
|
||||
# 服务器地址
|
||||
url = f'http://localhost:5701/'
|
||||
# 使用的api接口
|
||||
group = 'send_group_msg?group_id=839483517'
|
||||
# 验证access_token
|
||||
token = 'your_access_token'
|
||||
# gotify apptoken
|
||||
gotify_app_token = 'your_app_token'
|
||||
gotify_url = 'https://gotify.rainss.cn/message?token='
|
||||
|
||||
def __init__(self):
|
||||
self.sendurl = f"%s%s&access_token=%s" % (self.url, self.group, self.token)
|
||||
self.gotify_url = self.gotify_url + self.gotify_app_token
|
||||
|
||||
def cqHttp(self, message):
|
||||
s = requests.Session()
|
||||
s.get(self.sendurl + "&message=" + message)
|
||||
|
||||
def gotify(self, message, title="天翼云盘签到"):
|
||||
s = requests.Session()
|
||||
s.post(self.gotify_url, json={
|
||||
"message": message,
|
||||
"priority": 1,
|
||||
"title": title
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user