-
Notifications
You must be signed in to change notification settings - Fork 3
/
clientContinuous.js
132 lines (120 loc) · 4.14 KB
/
clientContinuous.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
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
const data = require("./info.json");
const { scheduleJob, Job, RecurrenceRule } = require("node-schedule");
exports.runClientContinuous = (channel, owner, token, client) => {
try {
const huntBattleRule = new RecurrenceRule();
huntBattleRule.second = [12, 43];
const owoRule = new RecurrenceRule();
owoRule.second = [0, 29];
/**
* @type { Job }
*/
let huntJob;
let owoJob;
client.on("ready", async () => {
console.log(`Quẩy lên! ${client.user.username}`);
if (!data.disable.hunt || !data.disable.battle)
huntJob = scheduleJob(huntBattleRule, () => {
setTimeout(() => {
if (!data.disable.hunt) client.channels.cache.get(channel).send("owoh");
}, getRandomInt(5000));
setTimeout(() => {
if (!data.disable.battle)
client.channels.cache.get(channel).send("owob");
}, getRandomInt(5000));
});
owoJob = scheduleJob(owoRule, () => {
if (!data.disable.owo) client.channels.cache.get(channel).send("owo");
});
});
client.on("messageCreate", async (message) => {
if (message.author.id !== "408785106942164992") return;
if (message.channel.id !== channel && message.channel.guild) return;
if (
["spent 5", "and caught an"].some((phrase) =>
message.content.toLowerCase().includes(phrase.toLowerCase())
)
) {
//stop
huntJob.cancel();
owoJob.cancel();
let randomGem = getRandomInt(data.inv.length);
setTimeout(() => {
client.channels.cache
.get(channel)
.send(
"owouse " +
data.inv[randomGem].toString() +
" " +
(data.inv[randomGem] + 14).toString() +
" " +
(data.inv[randomGem] + 21).toString()
);
}, 1686);
//cont
huntJob.reschedule(huntBattleRule);
owoJob.reschedule(owoRule);
}
});
client.on("messageCreate", async (message) => {
if (message.author.id !== "408785106942164992") return;
if (message.channel.id !== channel && message.channel.guild) return;
// if captcha
if (
[
"Beep Boop. A",
"real human?",
"can check!",
"Please DM me",
"Wrong verification",
" Please complete your captcha",
"solving the captcha",
"http://verify.owobot.com/",
" Please use the link ",
].some((phrase) =>
message.content.toLowerCase().includes(phrase.toLowerCase())
)
) {
// cancel job
huntJob.cancel();
owoJob.cancel();
if (client.user.id === owner) return;
// send message content
client.users.cache.get(owner).send(message.content);
// send image captcha
if (!!message.attachments.size && message.attachments.values().next()?.value?.url) {
client.users.cache.get(owner).send(message.attachments.values().next().value.url);
}
}
// if verify success -> reschedule -> send message success to owner
if (message.content.includes("Thank you")) {
huntJob.reschedule(huntBattleRule);
owoJob.reschedule(owoRule);
if (client.user.id === owner) return;
client.users.cache.get(owner).send(message.content);
}
});
client.on("messageCreate", async (message) => {
// send message captcha after resolve from owner to bot
if (message.author.id === owner && !message.channel.guild && message.content) {
client.users.cache.get("408785106942164992").send(message.content);
}
if (message.channel.id === channel && message.author.id === owner) {
if (message.content.toLowerCase() === "spy!stop") {
huntJob.cancel();
owoJob.cancel();
}
if (message.content.toLowerCase() === "spy!cont") {
huntJob.reschedule(huntBattleRule);
owoJob.reschedule(owoRule);
}
}
});
client.login(token);
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
} catch (e) {
console.log(e);
}
}