-
Notifications
You must be signed in to change notification settings - Fork 14
/
app.js
79 lines (71 loc) · 2.75 KB
/
app.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
const DiscordDatabase = require("discord-cloud-database");
const chalk = require("chalk");
const moment = require("moment");
const fs = require("fs");
const path = require("path");
require("dotenv").config();
const delay = (time) => {
return new Promise((resolve) => {
setTimeout(resolve, time);
});
};
const timeGreen = () => {
return chalk.green(moment().format("HH:mm:ss"));
};
const timeRed = () => {
return chalk.red(moment().format("HH:mm:ss"));
};
(async () => {
console.log(`
++++++++++++++++++++++++++++++++++++++++++++++
+ BOT PUSH LEVEL DISCORD | (Auto Send & Auto +
+ SUPPORT MULTIACCOUNT | Delete Messege) +
==============================================
+ Author: M Khoirul Risqi +
+ Github: https://github.com/risqikhoirul +
++++++++++++++++++++++++++++++++++++++++++++++
`);
while (true) {
const modulesToCheck = ["discord-cloud-database", "moment", "chalk", "dotenv"];
for (const moduleName of modulesToCheck) {
const modulePath = path.join(__dirname, "node_modules", moduleName);
if (!fs.existsSync(modulePath)) {
console.error(`Error: ${moduleName} is not installed. Please run "npm install ${moduleName}" and try again.`);
process.exit(1);
}
}
const mess = process.env.MESSAGE.split(",");
const Token = process.env.TOKEN.split(",");
let i = 0;
while (i < Token.length) {
const token = Token[i].trim();
i++;
const randomMsg = mess[Math.floor(mess.length * Math.random())];
const discordDatabase = new DiscordDatabase(token, { risqi: process.env.CHANNEL_ID });
try {
const readSend = await discordDatabase.insertOne(randomMsg, { name: "risqi" });
// console.log(readSend);
const readSendMsg = await discordDatabase.findOne(readSend.id, { name: "risqi" });
// console.log(readSendMsg);
const usr = chalk.yellow(`${readSendMsg.author.username}#${readSendMsg.author.discriminator}`);
console.log(`[ ${timeGreen()} ] [${usr}] Send Messege: ${readSendMsg.content}`);
const deletById = await discordDatabase.deleteMessageById(readSend.id, { name: "risqi" });
// console.log(deletById);
if (deletById === true) {
console.log(`[ ${timeGreen()} ] [${usr}] Success delete: ${chalk.yellow(readSend.id)}`);
} else {
console.log(`[ ${timeRed()} ] [${usr}] Failed delete: ${chalk.yellow(readSend.id)}`);
}
await delay(process.env.DELAY);
} catch (error) {
if (error.error.discordError === true) {
const usr = chalk.red("Token Failed");
console.log(`[ ${timeRed()} ] [${usr}] Please Check Token!!!`);
} else {
console.error(error);
}
await delay(process.env.DELAY);
}
}
}
})();