-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathtools.py
127 lines (106 loc) · 2.92 KB
/
tools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
def handler(fn):
def inner(*args, **kwargs):
res = fn(*args, **kwargs)
content = [
{
"h4": {
"content": res["name"],
},
},
{
"txt": {
"content": f"等级: {res['level']}",
},
},
{
"txt": {
"content": f"硬币: {res['coin']}",
},
},
{
"txt": {
"content": f"经验: {res['exp']}",
},
},
]
watch = res.get("watch")
if watch is not None:
content.append(
{
"txt": {
"content": watch,
}
}
)
share = res.get("share")
if share is not None:
content.append(
{
"txt": {
"content": f"分享视频: {share}",
}
}
)
coins = res.get("coins")
if coins is not None:
content.append(
{
"h5": {
"content": "投币",
},
"orderedList": {
"content": coins,
},
}
)
comics = res.get("comics")
if comics is not None:
content.extend(
[
{
"h5": {
"content": "漫画签到",
},
"txt": {
"content": f"连续签到 {comics} 天",
},
},
]
)
lb = res.get("lb")
if lb is not None:
content.extend(
[
{
"h5": {
"content": "直播",
},
"txt": {
"content": lb["raward"],
},
},
]
)
toCoin = res.get("toCoin")
if toCoin is not None:
content.append(
{
"h5": {
"content": "银瓜子兑换硬币",
},
"txt": {
"content": toCoin,
},
}
)
return content
return inner
def failed(*args, **kwargs):
print("[\033[31mfailed\033[0m] ", end="")
print(*args, **kwargs)
def success(*args, **kwargs):
print("[\033[32msuccess\033[0m] ", end="")
print(*args, **kwargs)
def info(*args, **kwargs):
print("[\033[34minfo\033[0m] ", end="")
print(*args, **kwargs)