-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.js
119 lines (108 loc) · 3.24 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
///////////////////////////
// Aayu5h and Sahil
// https://discord.gg/uepgJzsf6n
// https://spicydevs.me/
///////////////////////////
const Discord = require("discord.js-selfbot-v13");
const client = new Discord.Client({
readyStatus: false,
checkUpdate: false,
});
require("dotenv").config();
const config = require("./config.js");
function validateConfig(config) {
const requiredFields = [
"showTime",
"token",
"timeZone",
"Name",
"State",
"Details",
"FirstButtonName",
"FirstButtonUrl",
"SecondButtonName",
"SecondButtonUrl",
"LargeImage",
"LargeText",
"SmallImage",
"SmallText",
];
const missingFields = requiredFields.filter((field) => !config[field]);
if (missingFields.length > 0) {
console.error(`Config is not filled properly. Missing fields: ${missingFields.join(", ")}`);
process.exit(1); // Exit the process with an error code
}
}
let showTime = config.showTime;
client.on("ready", async () => {
var AsciiTable = require("ascii-table");
var table = new AsciiTable();
table.setBorder("❘", "─", "✾", "❀");
table.setTitle(`Logged In As ${client.user.username}!`);
table
.addRow(`Node.js`, `${process.version}`)
.addRow(
`Memory`,
`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB / ${(
process.memoryUsage().rss /
1024 /
1024
).toFixed(2)} MB`
);
setTimeout(() => {
console.log(table.toString());
}, 3000);
});
setInterval(() => {
const newTime = showTime ? formatTime() : "";
const timeZone = config.timeZone;
const Spicy = newTime;
const r = new Discord.RichPresence()
.setApplicationId("1155449771562127453")
.setType("WATCHING")
.setURL("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
.setState(config.State)
.setName(config.Name + Spicy)
.setDetails(config.Details)
.setStartTimestamp(Date.now())
.setAssetsLargeImage(config.LargeImage)
.setAssetsLargeText(config.LargeText)
.setAssetsSmallImage(config.SmallImage)
.setAssetsSmallText(config.SmallText)
.addButton(config.FirstButtonName, config.FirstButtonUrl)
.addButton(config.SecondButtonName, config.SecondButtonUrl);
client.user.setActivity(r);
}, 15000); // Update every 15 seconds
function formatTime() {
const date = new Date();
const options = {
timeZone: config.timeZone,
hour12: true,
hour: "numeric",
minute: "numeric",
day: "numeric",
month: "numeric",
year: "numeric",
};
const time = new Intl.DateTimeFormat("en-US", options).format(date);
const timeWithSeparator = time.replace(" ", " | "); // This is the time and date separator, don't touch, just use '|'
return timeWithSeparator;
}
setTimeout(() => {
if (!client || !client.user) {
console.log("Cient didn't logged in.. Killing the process..")
process.kill(1);
} else {
console.log("Client has succesfully logged in!")
}
}, 1 * 1000 * 20);
const keepAlive = require("./server.js");
keepAlive();
client.login(
config.token
);
///////////////////////////
// Aayu5h and Sahil
// https://discord.gg/uepgJzsf6n
// https://spicydevs.me/
///////////////////////////