commit
38d84db952
34
config.py
34
config.py
@ -5,13 +5,33 @@ from loghelper import log
|
|||||||
# 这个字段现在还没找好塞什么地方好,就先塞config这里了
|
# 这个字段现在还没找好塞什么地方好,就先塞config这里了
|
||||||
serverless = False
|
serverless = False
|
||||||
|
|
||||||
v5_config = '{"enable":false,"version":5,"account":{"cookie":"","login_ticket":"","stuid":"","stoken":""},"mihoyobbs":{' \
|
config = {
|
||||||
'"enable":true,"checkin":true,"checkin_multi":true,"checkin_multi_list":[2,5],"read_posts":true,' \
|
'enable': True, 'version': 5,
|
||||||
'"like_posts":true,"un_like":true,"share_post":true},"games":{"cn":{"enable":true,"hokai2":{' \
|
'account': {
|
||||||
'"auto_checkin":false,"black_list":[]},"honkai3rd":{"auto_checkin":false,"black_list":[]},' \
|
'cookie': '',
|
||||||
'"tears_of_themis":{"auto_checkin":false,"black_list":[]},"genshin":{"auto_checkin":false,"black_list":[' \
|
'login_ticket': '',
|
||||||
']}},"os":{"enable":false,"cookie":"","genshin":{"auto_checkin":false,"black_list":[]}}}} '
|
'stuid': '',
|
||||||
config = json.loads(v5_config)
|
'stoken': ''
|
||||||
|
},
|
||||||
|
'mihoyobbs': {
|
||||||
|
'enable': True, 'checkin': True, 'checkin_multi': True, 'checkin_multi_list': [2, 5],
|
||||||
|
'read_posts': True, 'like_posts': True, 'un_like': True, 'share_post': True
|
||||||
|
},
|
||||||
|
'games': {
|
||||||
|
'cn': {
|
||||||
|
'enable': True,
|
||||||
|
'genshin': {'auto_checkin': True, 'black_list': []},
|
||||||
|
'hokai2': {'auto_checkin': False, 'black_list': []},
|
||||||
|
'honkai3rd': {'auto_checkin': False, 'black_list': []},
|
||||||
|
'tears_of_themis': {'auto_checkin': False, 'black_list': []},
|
||||||
|
},
|
||||||
|
'os': {
|
||||||
|
'enable': False, 'cookie': '',
|
||||||
|
'genshin': {'auto_checkin': False, 'black_list': []}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
path = os.path.dirname(os.path.realpath(__file__)) + "/config"
|
path = os.path.dirname(os.path.realpath(__file__)) + "/config"
|
||||||
config_Path = f"{path}/config.json"
|
config_Path = f"{path}/config.json"
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
>此字段的作用是是否启用这个配置文件,`bool`类型,可设置`true`(默认)和`false`
|
>此字段的作用是是否启用这个配置文件,`bool`类型,可设置`true`(默认)和`false`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"config_Version": 3,
|
"config_Version": 5,
|
||||||
```
|
```
|
||||||
|
|
||||||
>此字段的作用是表明配置文件版本(不过脚本里面暂时没有用到),`int`类型
|
>此字段的作用是表明配置文件版本(4会被转成5),`int`类型
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"mihoyobbs_Login_ticket": "",
|
"mihoyobbs_Login_ticket": "",
|
||||||
@ -44,34 +44,34 @@
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
"mihoyobbs": {
|
"mihoyobbs": {
|
||||||
"bbs_Global": true,
|
"enable": true,
|
||||||
"bbs_Signin": true,
|
"checkin": true,
|
||||||
"bbs_Signin_multi": true,
|
"checkin_multi": true,
|
||||||
"bbs_Signin_multi_list": [2, 5],
|
"checkin_multi_list": [2, 5],
|
||||||
"bbs_Read_posts": true,
|
"read_posts": true,
|
||||||
"bbs_Like_posts": true,
|
"like_posts": true,
|
||||||
"bbs_Unlike": true,
|
"un_like": true,
|
||||||
"bbs_Share": true
|
"share_post": true
|
||||||
},
|
},
|
||||||
```
|
```
|
||||||
|
|
||||||
此字段的作用是米游币获取相关的设置,`object`类型(**python**里面是`dict`)
|
此字段的作用是米游币获取相关的设置,`object`类型(**python**里面是`dict`)
|
||||||
|
|
||||||
>`bbs_Global`的作用是是否启用米游币获取,`bool`类型,可设置`true`(默认)和`false`
|
>`enable`的作用是是否启用米游币获取,`bool`类型,可设置`true`(默认)和`false`
|
||||||
>
|
>
|
||||||
>`bbs_Signin`的作用是是否启用讨论区自动签到,`bool`类型,可设置`true`(默认)和`false`
|
>`checkin`的作用是是否启用讨论区自动签到,`bool`类型,可设置`true`(默认)和`false`
|
||||||
>
|
>
|
||||||
>`bbs_Signin_multi`的作用是是否启用多个讨论区签到(关闭的话只签到大别墅),`bool`类型,可设置`true`(默认)和`false`
|
>`checkin_multi`的作用是是否启用多个讨论区签到(关闭的话只签到大别墅),`bool`类型,可设置`true`(默认)和`false`
|
||||||
>
|
>
|
||||||
>`bbs_Signin_multi_list`的作用设置要签到的讨论区,`array`类型(**python**里面是`list`),可设置内容可以设置`[1,2,3,4,5]`签到全部讨论区,默认是`[2,5]`,可以通过调整id的位置来进行设置阅读/点赞/分享指定讨论区的帖子`[2,1,5]`(签到原神,崩坏3和大别墅)[讨论区的id对应关系](## 讨论区的id对应关系)
|
>`checkin_multi_list`的作用设置要签到的讨论区,`array`类型(**python**里面是`list`),可设置内容可以设置`[1,2,3,4,5]`签到全部讨论区,默认是`[2,5]`,可以通过调整id的位置来进行设置阅读/点赞/分享指定讨论区的帖子`[2,1,5]`(签到原神,崩坏3和大别墅)[讨论区的id对应关系](## 讨论区的id对应关系)
|
||||||
>
|
>
|
||||||
>`bbs_Read_posts`的作用是是否启用自动阅读帖子,`bool`类型,可设置`true`(默认)和`false`
|
>`read_posts`的作用是是否启用自动阅读帖子,`bool`类型,可设置`true`(默认)和`false`
|
||||||
>
|
>
|
||||||
>`bbs_Like_posts`的作用是是否启用自动点赞帖子,`bool`类型,可设置`true`(默认)和`false`
|
>`like_posts`的作用是是否启用自动点赞帖子,`bool`类型,可设置`true`(默认)和`false`
|
||||||
>
|
>
|
||||||
>`bbs_Unlike`的作用是是否启用自动取消帖子点赞(当`bbs_Like_posts`为`false`时本设置无效),`bool`类型,可设置`true`(默认)和`false`
|
>`un_like`的作用是是否启用自动取消帖子点赞(当`like_posts`为`false`时本设置无效),`bool`类型,可设置`true`(默认)和`false`
|
||||||
>
|
>
|
||||||
>`bbs_Share`的作用是是否启用自动分享帖子,`bool`类型,可设置`true`(默认)和`false`
|
>`share_post`的作用是是否启用自动分享帖子,`bool`类型,可设置`true`(默认)和`false`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"genshin_Auto_sign": true,
|
"genshin_Auto_sign": true,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[setting]
|
[setting]
|
||||||
enable=false
|
enable=false
|
||||||
#共有 cqhttp ftqq(sever酱) pushplus telegram
|
#共有 cqhttp ftqq(sever酱) pushplus telegram dingrobot
|
||||||
push_server=cqhttp
|
push_server=cqhttp
|
||||||
#server酱和pushplus的推送token
|
#server酱 pushplus dingrobot 的推送token
|
||||||
push_token=123456
|
push_token=123456
|
||||||
|
|
||||||
[cqhttp]
|
[cqhttp]
|
||||||
@ -25,3 +25,6 @@ wechat_id=
|
|||||||
[pushdeer]
|
[pushdeer]
|
||||||
api_url=https://api2.pushdeer.com
|
api_url=https://api2.pushdeer.com
|
||||||
token=
|
token=
|
||||||
|
|
||||||
|
[dingrobot]
|
||||||
|
api_url=https://oapi.dingtalk.com/robot/send
|
20
push.py
20
push.py
@ -99,6 +99,20 @@ def pushdeer(status, push_message):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# dingding robot
|
||||||
|
def dingrobot(status, push_message):
|
||||||
|
# print('dingrobot', title(status) + "\r\n" + push_message)
|
||||||
|
access_token=cfg.get('setting', 'push_token')
|
||||||
|
# print(f"https://oapi.dingtalk.com/robot/send?access_token={access_token}")
|
||||||
|
rep = http.post(
|
||||||
|
url=f"https://oapi.dingtalk.com/robot/send?access_token={access_token}",
|
||||||
|
headers={"Content-Type": "application/json; charset=utf-8"},
|
||||||
|
json={
|
||||||
|
"msgtype": "text", "text": { "content": title(status) + "\r\n" + push_message }
|
||||||
|
}
|
||||||
|
).json()
|
||||||
|
print(rep)
|
||||||
|
|
||||||
def push(status, push_message):
|
def push(status, push_message):
|
||||||
if not load_config():
|
if not load_config():
|
||||||
return 0
|
return 0
|
||||||
@ -107,9 +121,13 @@ def push(status, push_message):
|
|||||||
log.info("正在执行推送......")
|
log.info("正在执行推送......")
|
||||||
try:
|
try:
|
||||||
log.debug(f"推送所用的服务为:{push_server}")
|
log.debug(f"推送所用的服务为:{push_server}")
|
||||||
eval(push_server[:10].lower() + "(status, push_message)")
|
eval(push_server[:10] + "(status, push_message)")
|
||||||
except NameError:
|
except NameError:
|
||||||
log.warning("推送服务名称错误")
|
log.warning("推送服务名称错误")
|
||||||
else:
|
else:
|
||||||
log.info("推送完毕......")
|
log.info("推送完毕......")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
push(0, '推送正文')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user