This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 136
/
webhook.py
134 lines (114 loc) · 4.05 KB
/
webhook.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
128
129
130
131
132
133
134
import main
import requests
import user
def topLogin(data: list) -> None:
endpoint = main.webhook_discord_url
rewards: user.Rewards = data[0]
login: user.Login = data[1]
bonus: user.Bonus or str = data[2]
messageBonus = ''
nl = '\n'
if bonus != "No Bonus":
messageBonus += f"__{bonus.message}__{nl}```{nl.join(bonus.items)}```"
if bonus.bonus_name != None:
messageBonus += f"{nl}__{bonus.bonus_name}__{nl}{bonus.bonus_detail}{nl}```{nl.join(bonus.bonus_camp_items)}```"
messageBonus += "\n"
jsonData = {
"content": None,
"embeds": [
{
"title": "FGO Daily Bonus - " + main.fate_region,
"description": f"Scheluded Login Fate/Grand Order.\n\n{messageBonus}",
"color": 563455,
"fields": [
{
"name": "Level",
"value": f"{rewards.level}",
"inline": True
},
{
"name": "Tickets",
"value": f"{rewards.ticket}",
"inline": True
},
{
"name": "Saint Quartz",
"value": f"{rewards.stone}",
"inline": True
},
{
"name": "Login Days",
"value": f"{login.login_days}",
"inline": True
},
{
"name": "Total Days",
"value": f"{login.total_days}",
"inline": True
},
{
"name": "Total Friend Points",
"value": f"{login.total_fp}",
"inline": True
},
{
"name": "Friend Points",
"value": f"+{login.add_fp}",
"inline": True
},
{
"name": "Ap Max",
"value": f"{login.act_max}",
"inline": True
}
],
"thumbnail": {
"url": "https://grandorder.wiki/images/thumb/3/3d/Icon_Item_Saint_Quartz.png/200px-Icon_Item_Saint_Quartz.png"
}
}
],
"attachments": []
}
headers = {
"Content-Type": "application/json"
}
requests.post(endpoint, json=jsonData, headers=headers)
def drawFP(servants, missions) -> None:
endpoint = main.webhook_discord_url
message_mission = ""
message_servant = ""
if (len(servants) > 0):
servants_atlas = requests.get(
f"https://api.atlasacademy.io/export/JP/basic_svt_lang_en.json").json()
svt_dict = {svt["id"]: svt for svt in servants_atlas}
for servant in servants:
svt = svt_dict[servant.objectId]
message_servant += f"`{svt['name']}` "
if(len(missions) > 0):
for mission in missions:
message_mission += f"__{mission.message}__\n{mission.progressTo}/{mission.condition}\n"
jsonData = {
"content": None,
"embeds": [
{
"title": "FGO Daily Bonus - " + main.fate_region,
"description": f"Scheluded Friend Point Fate/Grand Order.\n\n{message_mission}",
"color": 5750876,
"fields": [
{
"name": "Gacha Result",
"value": f"{message_servant}",
"inline": False
}
],
"thumbnail": {
"url": "https://i.imgur.com/LJMPpP8.png"
}
}
],
"attachments": []
}
headers = {
"Content-Type": "application/json"
}
requests.post(endpoint, json=jsonData, headers=headers)