11 |
const AntiRaid = require("./AntiRaid"); |
const AntiRaid = require("./AntiRaid"); |
12 |
const MessageFilter = require("./MessageFilter"); |
const MessageFilter = require("./MessageFilter"); |
13 |
const { random } = require("../commands/pixabay"); |
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 |
|
|
40 |
this.spamFilter = new SpamFilter(); |
this.spamFilter = new SpamFilter(); |
41 |
this.antiRaid = new AntiRaid(); |
this.antiRaid = new AntiRaid(); |
42 |
this.messageFilter = new MessageFilter(); |
this.messageFilter = new MessageFilter(); |
43 |
|
this.afkEngine = new AFKEngine(); |
44 |
this.boot(); |
this.boot(); |
45 |
} |
} |
46 |
|
|
76 |
} |
} |
77 |
else if (valid && snippet !== undefined) { |
else if (valid && snippet !== undefined) { |
78 |
await message.channel.send({ |
await message.channel.send({ |
79 |
content: snippet.content |
content: snippet.content, |
80 |
|
files: snippet.files.map(f => { |
81 |
|
return { |
82 |
|
attachment: path.resolve(__dirname, '..', 'storage', f) |
83 |
|
} |
84 |
|
}) |
85 |
}); |
}); |
86 |
} |
} |
87 |
else if (valid && !has) { |
else if (valid && !has) { |
90 |
else if (valid && has && !allowed) { |
else if (valid && has && !allowed) { |
91 |
await this.commandManager.notAllowed(); |
await this.commandManager.notAllowed(); |
92 |
} |
} |
93 |
|
else if(!valid) { |
94 |
|
await this.afkEngine.start(message); |
95 |
|
} |
96 |
}); |
}); |
97 |
|
|
98 |
this.on("messageUpdate", async (oldMessage, newMessage) => { |
this.on("messageUpdate", async (oldMessage, newMessage) => { |
99 |
if (oldMessage.author.bot) |
if (oldMessage.author.bot || oldMessage.content === newMessage.content) |
100 |
return; |
return; |
101 |
|
|
102 |
await this.logger.logEdit(oldMessage, newMessage); |
await this.logger.logEdit(oldMessage, newMessage); |
103 |
}); |
}); |
104 |
|
|
105 |
|
|
106 |
|
this.on('guildBanAdd', async (ban) => { |
107 |
|
console.log('test'); |
108 |
|
await this.logger.logBanned(ban); |
109 |
|
}); |
110 |
|
|
111 |
|
this.on('guildBanRemove', async (ban) => { |
112 |
|
console.log('test'); |
113 |
|
await this.logger.logUnbanned(ban); |
114 |
|
}); |
115 |
|
|
116 |
this.on("messageDelete", async (message) => { |
this.on("messageDelete", async (message) => { |
117 |
if (message.author.bot) |
if (message.author.bot) |
118 |
return; |
return; |
140 |
this.on('guildMemberAdd', async (member) => { |
this.on('guildMemberAdd', async (member) => { |
141 |
console.log('Joined'); |
console.log('Joined'); |
142 |
await this.antiRaid.start(member); |
await this.antiRaid.start(member); |
143 |
|
await this.logger.logJoined(member); |
144 |
|
}); |
145 |
|
|
146 |
|
this.on('guildMemberRemove', async (member) => { |
147 |
|
await this.logger.logLeft(member); |
148 |
}); |
}); |
149 |
} |
} |
150 |
|
|