commit
38d84db952
34
config.py
34
config.py
@ -5,13 +5,33 @@ from loghelper import log
|
||||
# 这个字段现在还没找好塞什么地方好,就先塞config这里了
|
||||
serverless = False
|
||||
|
||||
v5_config = '{"enable":false,"version":5,"account":{"cookie":"","login_ticket":"","stuid":"","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,"hokai2":{' \
|
||||
'"auto_checkin":false,"black_list":[]},"honkai3rd":{"auto_checkin":false,"black_list":[]},' \
|
||||
'"tears_of_themis":{"auto_checkin":false,"black_list":[]},"genshin":{"auto_checkin":false,"black_list":[' \
|
||||
']}},"os":{"enable":false,"cookie":"","genshin":{"auto_checkin":false,"black_list":[]}}}} '
|
||||
config = json.loads(v5_config)
|
||||
config = {
|
||||
'enable': True, 'version': 5,
|
||||
'account': {
|
||||
'cookie': '',
|
||||
'login_ticket': '',
|
||||
'stuid': '',
|
||||
'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"
|
||||
config_Path = f"{path}/config.json"
|
||||
|
@ -13,10 +13,10 @@
|
||||
>此字段的作用是是否启用这个配置文件,`bool`类型,可设置`true`(默认)和`false`
|
||||
|
||||
```json
|
||||
"config_Version": 3,
|
||||
"config_Version": 5,
|
||||
```
|
||||
|
||||
>此字段的作用是表明配置文件版本(不过脚本里面暂时没有用到),`int`类型
|
||||
>此字段的作用是表明配置文件版本(4会被转成5),`int`类型
|
||||
|
||||
```json
|
||||
"mihoyobbs_Login_ticket": "",
|
||||
@ -44,34 +44,34 @@
|
||||
|
||||
```json
|
||||
"mihoyobbs": {
|
||||
"bbs_Global": true,
|
||||
"bbs_Signin": true,
|
||||
"bbs_Signin_multi": true,
|
||||
"bbs_Signin_multi_list": [2, 5],
|
||||
"bbs_Read_posts": true,
|
||||
"bbs_Like_posts": true,
|
||||
"bbs_Unlike": true,
|
||||
"bbs_Share": true
|
||||
"enable": true,
|
||||
"checkin": true,
|
||||
"checkin_multi": true,
|
||||
"checkin_multi_list": [2, 5],
|
||||
"read_posts": true,
|
||||
"like_posts": true,
|
||||
"un_like": true,
|
||||
"share_post": true
|
||||
},
|
||||
```
|
||||
|
||||
此字段的作用是米游币获取相关的设置,`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
|
||||
"genshin_Auto_sign": true,
|
||||
|
@ -1,8 +1,8 @@
|
||||
[setting]
|
||||
enable=false
|
||||
#共有 cqhttp ftqq(sever酱) pushplus telegram
|
||||
#共有 cqhttp ftqq(sever酱) pushplus telegram dingrobot
|
||||
push_server=cqhttp
|
||||
#server酱和pushplus的推送token
|
||||
#server酱 pushplus dingrobot 的推送token
|
||||
push_token=123456
|
||||
|
||||
[cqhttp]
|
||||
@ -24,4 +24,7 @@ wechat_id=
|
||||
|
||||
[pushdeer]
|
||||
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):
|
||||
if not load_config():
|
||||
return 0
|
||||
@ -107,9 +121,13 @@ def push(status, push_message):
|
||||
log.info("正在执行推送......")
|
||||
try:
|
||||
log.debug(f"推送所用的服务为:{push_server}")
|
||||
eval(push_server[:10].lower() + "(status, push_message)")
|
||||
eval(push_server[:10] + "(status, push_message)")
|
||||
except NameError:
|
||||
log.warning("推送服务名称错误")
|
||||
else:
|
||||
log.info("推送完毕......")
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
push(0, '推送正文')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user