-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.js
84 lines (77 loc) · 2.25 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
//Don't Change Anything Below, Dont Touch Anything
//Go To config.json and Put Your Bot User id in "Owner id"
// Put channel id where You want Spam in "spamChannelID"
//Put Token in Secret Variable key will be token and in value put Your User Token
//ninja is better
//plz dont change this stuffs / credits
const express = require('express')
const app = express();
const port = 3000
app.get('/', (req, res) => res.send('NINJA-69 Github , Rate Us A Star ⭐'))
app.listen(port, () =>
console.log(`ninja is the best! it is better than rest`)
);
const Discord = require('discord.js-selfbot');
const cron = require('node-cron');
const settings = require('./config.json');
const client = new Discord.Client();
const prefix = settings.prefix;
const color = "RANDOM";
const spawnChannelID = settings.spawnChannelID;
const botPrefix = settings.pokeTwoBotPrefix;
const spamChannelID = settings.spamChannelID;
var spamming = false;
var chrons = false;
client.on("ready", () => {
console.log("[INFO] Starting...\n[INFO] NinSpammer");
if (settings.autoSpam == false) return;
client.channels.fetch(spamChannelID)
.then(channel => {
channel.send(`${prefix}spam on`);
})
})
client.on('message', msg => {
if (!msg.content.startsWith(prefix)) return;
if (msg.author.id != settings.ownerID) return;
let args = msg.content.toLowerCase().slice(prefix.length).trim().split(" ");
let cmd = args.shift();
if (cmd == "spam") {
msg.delete();
if (!args[0]) return;
if (args[0] == "on") {
if (spamming == true) return;
spamming = true;
if (chrons == true) return;
chrons = true;
return startChrons(msg);
}
if (args[0] == "off") {
return spamming = false;
}
return;
}
try {
msg.delete();
let cmdFile = require(`./commands/${cmd}.js`);
cmdFile.run(client, msg, args, settings, prefix, color);
} catch (e) {
console.log("[Commands] Not A Command");
console.log(e);
}
});
function startChrons(msg) {
cron.schedule('*/4 * * * * *', () => {
if (spamming) {
sendMsg(msg);
}
});
cron.schedule('*/6 * * * * *', () => {
if (spamming) {
sendMsg(msg);
}
});
}
function sendMsg(msg) {
msg.channel.send(Math.random().toString(36).substr(2, 7));
}
client.login(process.env.token);