9 |
const SpamFilter = require("./SpamFilter"); |
const SpamFilter = require("./SpamFilter"); |
10 |
const server = require("./server"); |
const server = require("./server"); |
11 |
const AntiRaid = require("./AntiRaid"); |
const AntiRaid = require("./AntiRaid"); |
12 |
|
const MessageFilter = require("./MessageFilter"); |
13 |
|
const { random } = require("../commands/pixabay"); |
14 |
|
const AFKEngine = require("./AFKEngine"); |
15 |
|
|
16 |
class App { |
class App { |
17 |
constructor(rootdir) { |
constructor(rootdir) { |
29 |
Intents.FLAGS.DIRECT_MESSAGE_TYPING, |
Intents.FLAGS.DIRECT_MESSAGE_TYPING, |
30 |
Intents.FLAGS.GUILD_PRESENCES, |
Intents.FLAGS.GUILD_PRESENCES, |
31 |
Intents.FLAGS.GUILD_MEMBERS, |
Intents.FLAGS.GUILD_MEMBERS, |
32 |
|
Intents.FLAGS.GUILD_BANS |
33 |
] |
] |
34 |
}); |
}); |
35 |
|
|
39 |
this.logger = new Logger(); |
this.logger = new Logger(); |
40 |
this.spamFilter = new SpamFilter(); |
this.spamFilter = new SpamFilter(); |
41 |
this.antiRaid = new AntiRaid(); |
this.antiRaid = new AntiRaid(); |
42 |
|
this.messageFilter = new MessageFilter(); |
43 |
|
this.afkEngine = new AFKEngine(); |
44 |
this.boot(); |
this.boot(); |
45 |
} |
} |
46 |
|
|
47 |
boot() { |
boot() { |
48 |
this.on('ready', () => { |
this.on('ready', () => { |
49 |
console.log("Logged in as " + this.client.user.tag); |
console.log("Logged in as " + this.client.user.tag); |
50 |
|
|
51 |
|
this.client.user.setStatus(random(['dnd', 'idle'])); |
52 |
|
this.client.user.setActivity("over the server", { type: "WATCHING" }); |
53 |
|
|
54 |
server(); |
server(); |
55 |
}); |
}); |
56 |
|
|
62 |
await (this.msg = message); |
await (this.msg = message); |
63 |
|
|
64 |
await this.spamFilter.start(message); |
await this.spamFilter.start(message); |
65 |
|
await this.messageFilter.start(message, this.commandManager); |
66 |
|
|
67 |
await this.commandManager.setMessage(message); |
await this.commandManager.setMessage(message); |
68 |
|
|
85 |
else if (valid && has && !allowed) { |
else if (valid && has && !allowed) { |
86 |
await this.commandManager.notAllowed(); |
await this.commandManager.notAllowed(); |
87 |
} |
} |
88 |
|
else if(!valid) { |
89 |
|
await this.afkEngine.start(message); |
90 |
|
} |
91 |
}); |
}); |
92 |
|
|
93 |
this.on("messageUpdate", async (oldMessage, newMessage) => { |
this.on("messageUpdate", async (oldMessage, newMessage) => { |
94 |
if (oldMessage.author.bot) |
if (oldMessage.author.bot || oldMessage.content === newMessage.content) |
95 |
return; |
return; |
96 |
|
|
97 |
await this.logger.logEdit(oldMessage, newMessage); |
await this.logger.logEdit(oldMessage, newMessage); |
98 |
}); |
}); |
99 |
|
|
100 |
|
|
101 |
|
this.on('guildBanAdd', async (ban) => { |
102 |
|
console.log('test'); |
103 |
|
await this.logger.logBanned(ban); |
104 |
|
}); |
105 |
|
|
106 |
|
this.on('guildBanRemove', async (ban) => { |
107 |
|
console.log('test'); |
108 |
|
await this.logger.logUnbanned(ban); |
109 |
|
}); |
110 |
|
|
111 |
this.on("messageDelete", async (message) => { |
this.on("messageDelete", async (message) => { |
112 |
if (message.author.bot) |
if (message.author.bot) |
113 |
return; |
return; |
135 |
this.on('guildMemberAdd', async (member) => { |
this.on('guildMemberAdd', async (member) => { |
136 |
console.log('Joined'); |
console.log('Joined'); |
137 |
await this.antiRaid.start(member); |
await this.antiRaid.start(member); |
138 |
|
await this.logger.logJoined(member); |
139 |
|
}); |
140 |
|
|
141 |
|
this.on('guildMemberRemove', async (member) => { |
142 |
|
await this.logger.logLeft(member); |
143 |
}); |
}); |
144 |
} |
} |
145 |
|
|