-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
68 lines (54 loc) · 2 KB
/
index.js
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
(async () => {
const convertTime = async (input) => {
const parts = input.split(" ");
let hours = 0;
let minutes = 0;
for (let part of parts) {
if (part.endsWith("h")) {
hours = parseInt(part.slice(0, -1), 10);
} else if (part.endsWith("m")) {
minutes = parseInt(part.slice(0, -1), 10);
}
}
const totalMilliseconds = hours * 60 * 60 * 1000 + minutes * 60 * 1000;
return totalMilliseconds;
};
document
.querySelector(
"#root > div > div > div:nth-child(1) > div > div > div > div:nth-child(4) > div:nth-child(2)"
)
.click();
await new Promise((res) => setTimeout(res, 3 * 1000));
while (1) {
try {
const getTimeToRecovery = document.querySelector(
"#root > div > div > div:nth-child(3) > div > div:nth-child(3) > div > div:nth-child(2) > div:nth-child(2) > p:nth-child(2)"
).textContent;
const btnClaimOrNews = document.querySelector(
"#root > div > div > div:nth-child(3) > div > div:nth-child(3) > div > div:nth-child(2) > div:nth-child(3) > button"
);
const gashot = document.querySelector(
"body > div:nth-child(8) > div > div.react-modal-sheet-content > div > div > div:nth-child(3) > button"
);
if (getTimeToRecovery.includes("fill")) {
const timeToRecovery = await convertTime(getTimeToRecovery);
await new Promise((res) => setTimeout(res, timeToRecovery + 10000));
continue;
}
if (gashot) {
gashot.click();
}
btnClaimOrNews.click();
const checkClickClaim = btnClaimOrNews.getAttribute("disabled");
if (checkClickClaim == null) {
btnClaimOrNews.click();
await new Promise((res) => setTimeout(res, 10 * 1000));
}
const timeToRecovery = await convertTime(getTimeToRecovery);
await new Promise((res) => setTimeout(res, timeToRecovery + 10000));
} catch (error) {
console.error(error);
await new Promise((res) => setTimeout(res, 5 * 1000));
}
}
})();