-
Notifications
You must be signed in to change notification settings - Fork 176
/
app.js
84 lines (67 loc) · 2.58 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
80
81
82
83
84
const Discord = require('discord.js');
const figlet = require('figlet');
const colors = require('colors');
const readline = require('readline');
const config = require('./config.json');
const bot = new Discord.Client();
const cmdsArray = [
"dmall <message>",
"dmrole <role> <message>"
];
bot.on("ready", () => {
clear();
});
bot.on("message", (message) => {
if(config.restrictToID == true && message.author.id != config.id) return;
if(message.channel.type == "dm") return;
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if(command == "help"){
const embed = new Discord.RichEmbed()
.addField("Commands", cmdsArray)
.addField("Info", "Thanks for using MassDM v2\nIt was very fun creating this bot.\nIf you need any help with this, contact me on V3rmillion. https://v3rmillion.net/member.php?action=profile&uid=416339");
message.channel.send({embed: embed});
}
if(command == "dmall") {
let dmGuild = message.guild;
let msg = args.join(' ');
if(!msg || msg.length <= 0) return message.author.send("No message specified!");
dmGuild.members.forEach(member => {
setTimeout(function(){
if(member.id == bot.user.id) return processed++;
console.log(`DMing ${member.user.username}`);
member.send(`${msg} ${Math.floor(Math.random() * 9999)}`);
}, Math.floor(Math.random() * 9000));
});
}
if(command == "dmrole") {
let role = message.mentions.roles.first();
let msg = args.join(' ');
if(!role) {
message.author.send("No valid role mentioned!");
return;
}
if(!msg || msg.length <= 0) {
message.author.send("Specify a message!");
return;
}
role.members.forEach(member => {
setTimeout(function() {
if(member.id == bot.user.id) return;
console.log(`DMing ${member.user.username}`);
member.send(`${msg} ${Math.floor(Math.random() * 9999)}`);
}, Math.floor(Math.random() * 9000));
});
}
});
bot.on("error", (error) => {
bot.login(config.token);
});
bot.login(config.token);
function clear() {
console.clear();
console.log(figlet.textSync("MassDM v2").green);
console.log("\n\nMass DM bot for Discord. Created by Gringo(Scammer ALT).\n");
console.log("Now with a better self-bot anti-ban system!");
console.log(`Type ${config.prefix}help in a chat.`);
}