-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
360 lines (332 loc) · 14.1 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
const BootLoader = require("./BootLoader.js");
BootLoader.StartUpChecks();
const { CommandoClient } = require("discord.js-commando");
const BotConfiguration = require("./Configuration.js");
const BadWords = require("./BadWords.js");
const System = require("./System.js");
const discord = require("discord.js");
const token = require("./Token.js");
const chalk = require("chalk");
const db = require("quick.db");
const path = require("path");
const fs = require("fs");
const ms = require("ms");
const bot = new CommandoClient({
commandPrefix: BotPrefix,
owner: ServerOwnerID,
});
//TODO Have commands like mute send could not message users in chat rather than console
bot.registry
.registerDefaultTypes()
.registerGroups([
['admin', 'Admin'],
['bot', "Bot"],
['economy', 'Economy'],
['fun', 'Fun Commands'],
['support', 'Support'],
])
.registerDefaultGroups()
.registerDefaultCommands()
.registerCommandsIn(path.join(__dirname, 'commands'));
//End of command registration
bot.login(key);
bot.on('ready', function(){
bot.user.setActivity(ActivityMessage);
console.log(`Successfully Signed Into: ${bot.user.tag}`);
console.log(`Bot Developer: ${Developer}`);
console.log(`Build Version: ${BuildID}`);
console.log(`Running Version: ${Version}`);
});
//New Member Message
bot.on('guildMemberAdd', member => {
//Welcome Message
const NewMemberMessage = new discord.MessageEmbed()
.setTimestamp()
.setColor("RANDOM")
.setThumbnail(member.user.displayAvatarURL())
.setTitle(`Welcome to ${member.guild.name}, ${member.user.tag}!`)
.setDescription(`
:globe_with_meridians: Discord: https://discord.gg/AURDPCN
:satellite: Minecraft IP: <#704460219521957907>
${member}, you are the ${member.guild.memberCount} member!
Don't forget to read <#703833697153187840> and <#704893263177580544>!
`)
let NewMemberChannel = member.guild.channels.cache.get(WelcomeChannelID);
NewMemberChannel.send(NewMemberMessage);
//New Member Role
let MemberRole = member.guild.roles.cache.get(NewMemberRoleID);
member.roles.add(MemberRole);
});
//Member Leaves
bot.on('guildMemberRemove', member => {
const MemberLeaveMessage = new discord.MessageEmbed()
.setTimestamp()
.setColor("#00008b")
.setThumbnail(member.user.displayAvatarURL())
.setTitle("Lost a member")
.setDescription(`
${member} (${member.user.tag}) left the server :(
`)
let MemberLeaveChannel = member.guild.channels.cache.get(MemberLeaveChannelID);
MemberLeaveChannel.send(MemberLeaveMessage);
});
bot.on('message', function(message){
//Message Reactions
if (message.content == "1234"){
message.reply("I declare a Ginger war!");
}
if (message.content == "4321"){
message.reply("Are you sure about that?");
}
if (message.content == "pizza"){
message.reply("Can I have a slice of pizza? Please?");
}
if (message.content == "Bob Bingi"){
message.channel.send("It's the one and only Bob Bingi! Introducing Markiplier and B.B! https://www.youtube.com/watch?v=0Pocn8aSWS4 make sure to watch!");
}
if (message.content == "dapopo"){
message.reply("You knew him?");
}
if (message.content == "UnusAnnus"){
message.reply("Momento Mori");
}
//Listener for Minecraft IP
var MCIPListener = [" ip ", " address "];
let msg = message.content.toLowerCase();
for (x = 0; x < MCIPListener.length; x++){
if (msg.includes(MCIPListener[x])){
if (message.author.bot)return;
message.reply("If you need the IP for the Minecraft server, please visit <#704460219521957907>!");
}
}
//Level Up System
if (db.get("settings.LevelUpSystem")== 1){
if (message.author.bot)return;
if (message.guild === null)return;
if (message.channel.id === `${ChannelExcludeID}`)return;
var randomXP = Math.floor(Math.random() * RandomXP);
db.add(`${message.author.id}.basic.xp`, randomXP);
//Level Up Message
if (db.get(`${message.author.id}.basic.xp`) > MaxXP){
if (message.author.bot)return;
if (message.guild === null)return;
db.delete(`${message.author.id}.basic.xp`);
db.add(`${message.author.id}.basic.level`, 1);
db.add(`${message.author.id}.basic.money`, LevelUpMoney);
const LevelUpMessage = new discord.MessageEmbed()
.setColor('0x0000FF')
.setTimestamp()
.setThumbnail(message.author.displayAvatarURL())
.setTitle(":tada: Level Up!")
.setDescription(`
**User:** ${message.author}
**Level:** ${db.get(`${message.author.id}.basic.level`)}
`)
.setFooter(`You have received $${LevelUpMoney}! Nice job!`)
let LevelUpChannel = message.guild.channels.cache.get(LevelUpChannelID);
LevelUpChannel.send(LevelUpMessage);
}
}
});
//Auto Moderation
bot.on('message', function(message){
if (db.get("settings.AutoModeration")== 1){
if (message.guild === null)return;
if (message.author.bot)return;
let ModLogChannel = message.guild.channels.cache.get(ModLogID);
//Auto Moderation Bypass
if (message.member.hasPermission(AMBypassPermissionCheck)){
return;
}
//Mute Bypass Protection
if (db.get("AutoModeration.MuteBypassProtection") == "1"){
if (db.get(`${message.author.id}.admin.CurrentlyMuted`)== 1){
message.delete();
db.add(`${message.author.id}.admin.TimesBypassedMute`, 1);
let MuteRole = message.guild.roles.cache.get(MuteRoleID);
message.member.roles.add(MuteRole);
//Chat Response
const MuteBypassMessage = new discord.MessageEmbed()
.setTimestamp()
.setColor("")//Keep Empty
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setDescription(`
**Mute Bypasses:** ${db.get(`${message.author.id}.admin.TimesBypassedMute`)}
`)
.setFooter("Auto Moderation: Mute Bypass")
message.channel.send(MuteBypassMessage).then(message => {
message.delete({timeout: 15000});
});
//Logged Response
const MuteBypassMessageLog = new discord.MessageEmbed()
.setTimestamp()
.setColor("")//Keep Empty
.setAuthor("Mute Bypass | "+message.author.tag, message.author.displayAvatarURL())
.setDescription(`
**User:** ${message.author}
**Channel:** ${message.channel}
**Bypasses:** ${db.get(`${message.author.id}.admin.TimesBypassedMute`)}
`)
.setFooter("Auto Moderation: Mute Bypass")
ModLogChannel.send(MuteBypassMessageLog);
}
}else{
return;
}
//Chat Filter
if (db.get("AutoModeration.ChatFilter") == "1"){
let msg = message.content.toLowerCase();
for (x = 0; x < profanities.length; x++){
if (msg.includes(profanities[x])){
message.delete();
db.add(`{AMPSChatFilter}_${message.author.id}`, 1);
//Chat Response
const ChatFilterMessage = new discord.MessageEmbed()
.setTimestamp()
.setColor("#FFFF00")
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setDescription(`
${message.author}, cursing **isn't** allowed!
`)
.setFooter("Auto Moderation: Chat Filter")
message.channel.send(ChatFilterMessage).then(message => {
message.delete({timeout: 15000});
});
//Logged Response
const ChatFilterMessageLog = new discord.MessageEmbed()
.setTimestamp()
.setColor("#FFFF00")
.setAuthor("Chat Filter | "+message.author.tag, message.author.displayAvatarURL())
.setDescription(`
**User:** ${message.author}
**Channel:** ${message.channel}
**Message:** ${message.content}
`)
.setFooter("Auto Moderation: Chat Filter")
ModLogChannel.send(ChatFilterMessageLog);
}
}
}else{
return;
}
//Discord Invite Checker
if (db.get("AutoModeration.DiscordInviteChecker") == "1"){
if (message.content.includes('discord.gg/'||'discordapp.com/invite/')){
message.delete();
//Chat Response
const DiscordInviteWarning = new discord.MessageEmbed()
.setTimestamp()
.setColor("")//Leave empty
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setDescription(`
${message.author}, Discord invites aren't allowed!
`)
.setFooter("Auto Moderation: Discord Invite")
message.channel.send(DiscordInviteWarning).then(message => {
message.delete({timeout: 15000});
});
//Logged Response
const DiscordInviteWarningLog = new discord.MessageEmbed()
.setTimestamp()
.setColor("")//Leave empty
.setAuthor("Discord Invite | "+message.author.tag, message.author.displayAvatarURL())
.setDescription(`
**User:** ${message.author}
**Channel:** ${message.channel}
**Message:** ${message.content}
`)
.setFooter("Auto Moderation: Discord Invite")
ModLogChannel.send(DiscordInviteWarningLog);
}
}else{
return;
}
}else{
return;
}
});
//Auto Moderation | Edited Messages
bot.on('messageUpdate', (oldMessage, newMessage) => {
if (db.get("settings.AutoModeration")== 1){
if (db.get("AutoModeration.EditedMessageLogger") == 1){
if (newMessage.guild === null)return;
if(newMessage.embeds.length > 0)return;
if (!oldMessage.author) return;
const MessageLog = bot.channels.cache.find(channel => channel.id === EditedMessagesLogChannelID);
if(newMessage == null)return;
const EditedMessage = new discord.MessageEmbed()
.setTimestamp()
.setColor("")//Leave empty
.setAuthor("Edited Message | "+newMessage.author.tag, newMessage.author.displayAvatarURL())
.setDescription(`
**User:** ${newMessage.author}
**Channel:** ${newMessage.channel}
**Original Message:** ${oldMessage}
**New Message:** ${newMessage}
`)
.setFooter("Auto Moderation: Edited Message")
MessageLog.send(EditedMessage);
}
}
});
//Auto Moderation | Deleted Messages
bot.on('messageDelete', async (message) => {
if (db.get("settings.AutoModeration")== 1) {
if (db.get("AutoModeration.DeletedMessageLogger") == "1"){
if (message.guild === null)return;
if(message.embeds.length > 0)return;
let ModLogChannel = message.guild.channels.cache.get(DeletedMessageLogChannelID);
const entry = await message.guild.fetchAuditLogs({type: 'MESSAGE_DELETE'}).then(audit => audit.entries.first());
let user = ""
if (entry.extra.channel.id === message.channel.id
&& (entry.target.id === message.author.id)
&& (entry.createdTimestamp > (Date.now() - 5000))
&& (entry.extra.count >= 1)) {
user = entry.executor
}else{
user = message.author;
}
const DeletedMessageLog = new discord.MessageEmbed()
.setTimestamp()
.setColor("#fc3c3c")
.setThumbnail(user.displayAvatarURL())
.setAuthor("Deleted Message | "+message.author.tag, message.author.displayAvatarURL())
.setDescription(`
**Executor:** ${user}
**Author:** ${message.author}
**Channel:** ${message.channel}
**Message:** ${message.content}
`)
.setFooter("Auto Moderation: Deleted Message")
ModLogChannel.send(DeletedMessageLog);
}else {
return;
}
}else{
return;
}
});
//Dead Chat Pings
bot.on('ready', () => {
setInterval(() => {
if (db.get("settings.DeadChatPings")== 1){
const DCPQuestion = Math.floor(Math.random() * DeadChatQuestions.length);
const DeadChatMessage = new discord.MessageEmbed()
.setTimestamp()
.setColor("RANDOM")
.attachFiles('./Images/DCP_Question.png')
.setThumbnail('attachment://DCP_Question.png')
.setTitle("Dead Chat Ping!")
.addField(DeadChatQuestions[DCPQuestion], `<@&${DCPRoleID}>`)
let PingChannel = bot.channels.cache.get(DCPChannelID);
PingChannel.send(DeadChatMessage);
function DCP(message){
PingChannel.send(`Dead Chat Ping! <@&${DCPPingRoleID}>`).then(message => {
message.delete();
});
}
}else{
return;
}
}, ms(`${PingTime}`));
});