-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
136 lines (123 loc) · 3.7 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
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
135
136
const { Intents, Client } = require("discord.js-selfbot-v13")
const configParse = require("./configParse")
const buttonHandler = require("./buttonHandler")
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGES,
],
checkUpdate: false,
})
const {
ALLOWED_CHANNEL_ID,
CHARACTERS,
MIN_VALUE_CHARACTERS,
MIN_VALUE_KAKERA,
TOKEN,
MARRY_ALL_WISHED,
} = configParse()
;(async () => {
try {
await client.login(TOKEN)
client.on("ready", () => {
console.log("CLIENT CONNECTED")
})
client.on("messageCreate", async (msg) => {
if (msg.author.id === "432610292342587392") {
if (msg.components.length === 0) return
if (ALLOWED_CHANNEL_ID.includes(msg.channel.id)) {
const msgComponents = msg.components[0]
const description = msg.embeds[0]?.description.split("**")
// Kakera Reaction
if (
msg.embeds[0]?.color === "6753288" ||
msg.embeds[0]?.footer?.text?.includes("Pertence")
) {
if (
msgComponents.components[0].emoji.name.includes("kakera") &&
description[1] >= MIN_VALUE_KAKERA
) {
return await buttonHandler(
TOKEN,
msg.guildId,
msg.channelId,
msg.id,
msgComponents.components[0].customId
)
}
return null
}
// Marry by Characters
if (CHARACTERS.includes(msg.embeds[0]?.author?.name)) {
return await buttonHandler(
TOKEN,
msg.guildId,
msg.channelId,
msg.id,
msgComponents.components[0].customId
)
}
// Marry by Value
if (description[1] >= MIN_VALUE_CHARACTERS) {
return await buttonHandler(
TOKEN,
msg.guildId,
msg.channelId,
msg.id,
msgComponents.components[0].customId
)
}
// Marry by Wish
description.forEach(async (element) => {
if (element?.includes("Desejado por") && MARRY_ALL_WISHED) {
return await buttonHandler(
TOKEN,
msg.guildId,
msg.channelId,
msg.id,
msgComponents.components[0].customId
)
}
})
// Marry even if there's no reaction
if (ALLOWED_CHANNEL_ID.includes(msg.channel.id)) {
if (description !== undefined) {
// Marry by Value
if (description[1] >= MIN_VALUE_CHARACTERS) {
return await buttonHandler(
TOKEN,
msg.guildId,
msg.channelId,
msg.id,
msgComponents.components[0].customId
)
}
// Marry by Wish
description.forEach(async (element) => {
if (element?.includes("Desejado por") && MARRY_ALL_WISHED) {
return await buttonHandler(
TOKEN,
msg.guildId,
msg.channelId,
msg.id,
msgComponents.components[0].customId
)
}
})
}
}
}
}
})
} catch (error) {
console.log(error)
if (
error.toString().includes("An invalid token was provided") ||
error.toString().includes("401: Unauthorized")
) {
console.log("Invalid Token on config.txt")
process.exit(1)
}
}
})()