|
14 | 14 | Main developer steam: https://steamcommunity.com/id/MajokingGames/ |
15 | 15 | Mail: refloowlibrarycontact@gmail.com |
16 | 16 |
|
| 17 | +* Donations: |
| 18 | + Crypto: https://refloow.com/cdonate |
| 19 | + Steam: https://steamcommunity.com/tradeoffer/new/?partner=994828078&token=XEUdbqp6 |
17 | 20 | --------------------------------------------------------------------------------------------*/ |
| 21 | + |
18 | 22 | /* |
19 | 23 |
|
20 | 24 | // legal advice: PERMISSIONS AND RIGHTS |
|
35 | 39 | Removing copyright notice & distributing, using or selling the software without |
36 | 40 | the original license and copyright notice is licence agreement breach and its considered criminal offense and piracy. |
37 | 41 | =================================================================================== |
38 | | -
|
39 | 42 | */ |
40 | 43 |
|
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | | -//////////////////////////////////////////////////// |
46 | | -//------------------------------------------------// |
47 | | -// Script checks, imports // |
48 | | -//------------------------------------------------// |
49 | | -//////////////////////////////////////////////////// |
50 | | - |
51 | | - |
52 | 44 | // Checking if all modules are installed correctly |
53 | 45 |
|
54 | 46 | try { |
55 | | - // Checking if discord module is installed correctly |
56 | | - Discord = require ('discord.js'); |
57 | | - // Checking if console-master module is installed correctly |
58 | | - Console = require ('console-master'); |
| 47 | + colors = require('colors'); |
59 | 48 | } catch (ex) { |
60 | 49 | console.log('\n\n\n | [Modules] |: Missing dependecies Run install.bat file or use npm install. \n\n\n'); |
61 | 50 | console.log(ex); |
62 | 51 | process.exit(1); |
63 | 52 | } |
64 | 53 |
|
65 | | -// Setting other things for the project |
66 | | - |
67 | | -const config = require('../Settings/config.js'); |
68 | | -const method = require('./methods.js'); |
69 | | -const refloow = new Discord.Client(); |
70 | | -var servers = {}; |
71 | | - |
72 | | - |
73 | | -//////////////////////////////////////////////////// |
74 | | -//------------------------------------------------// |
75 | | -// Starting the client // |
76 | | -//------------------------------------------------// |
77 | | -//////////////////////////////////////////////////// |
78 | | - |
79 | | -// Client on 'ready' |
80 | | - |
81 | | -refloow.on('ready', () => { |
82 | | - Console.true("| [Discord] | Succesfully connected as " + refloow.user.tag) |
83 | | - |
84 | | - refloow.user.setActivity(config.DisplayMessage, {type: config.Type}) |
85 | | - |
86 | | - refloow.guilds.forEach((guild) =>{ |
87 | | - Console.true("| [Discord] | Connected to server: "+guild.name) |
88 | | - guild.channels.forEach((channel) => { |
89 | | - }) |
90 | | - }) |
91 | | -}) |
92 | | - |
93 | | - |
94 | | -//////////////////////////////////////////////////// |
95 | | -//------------------------------------------------// |
96 | | -// Moderating links // |
97 | | -//------------------------------------------------// |
98 | | -//////////////////////////////////////////////////// |
99 | | - |
100 | | - |
101 | | -// If moderating links is enabled proceed |
102 | | -if(method.ModeratingLinks()) { |
103 | | - // on message |
104 | | - refloow.on("message", (message) => { |
105 | | - // check if message is sent in allowd channel |
106 | | - if (message.channel.id === config.Allowed_Channel_1) { |
107 | | - // check if the message in allowed channel has url |
108 | | - if (method.containsUrl(message.content)) { |
109 | | - // check if url is allowed |
110 | | - if (method.isAllowedUrl(message.content)) { |
111 | | - } else { |
112 | | - // if it isnt allowed url |
113 | | - // tell user url is not allowed |
114 | | - if(method.MessageAfterDeleteLink()) { |
115 | | - message.author.send(config.MessageOnDelete_1) |
116 | | - } |
117 | | - // If user has required permissions in channel |
118 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
119 | | - // then delete it |
120 | | - message.delete() |
121 | | - } else {} |
122 | | - } |
123 | | - } else { |
124 | | - // it's not an url |
125 | | - // do nothing |
126 | | - } |
127 | | - // Check if channel is allowed channel |
128 | | - } else if (message.channel.id === config.Allowed_Channel_2) { |
129 | | - // check if the message in allowed channel has url |
130 | | - if (method.containsUrl(message.content)) { |
131 | | - // check if url is allowed |
132 | | - if (method.isAllowedUrl2(message.content)) { |
133 | | - } else { |
134 | | - // if it isnt allowed url |
135 | | - // tell user url is not allowed |
136 | | - if(method.MessageAfterDeleteLink()) { |
137 | | - message.author.send(config.MessageOnDelete_2) |
138 | | - } |
139 | | - // If user has required permissions in channel |
140 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
141 | | - // then delete it |
142 | | - message.delete() |
143 | | - } else {} |
144 | | - } |
145 | | - } else { |
146 | | - // it's not an url |
147 | | - // do nothing |
148 | | - } |
149 | | - // Check if channel is allowed channel |
150 | | - } else if (message.channel.id === config.Allowed_Channel_3) { |
151 | | - // check if the message in allowed channel has url |
152 | | - if (method.containsUrl(message.content)) { |
153 | | - // check if url is allowed |
154 | | - if (method.isAllowedUrl3(message.content)) { |
155 | | - } else { |
156 | | - // if it isnt allowed url |
157 | | - // tell user url is not allowed |
158 | | - if(method.MessageAfterDeleteLink()) { |
159 | | - message.author.send(config.MessageOnDelete_3) |
160 | | - } |
161 | | - // If user has required permissions in channel |
162 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
163 | | - // then delete it |
164 | | - message.delete() |
165 | | - } else {} |
166 | | - } |
167 | | - } else { |
168 | | - // it's not an url |
169 | | - // do nothing |
170 | | - } |
171 | | - // Check if channel is allowed channel |
172 | | - } else if (message.channel.id === config.Allowed_Channel_4) { |
173 | | - // check if the message in allowed channel has url |
174 | | - if (method.containsUrl(message.content)) { |
175 | | - // check if url is allowed |
176 | | - if (method.isAllowedUrl4(message.content)) { |
177 | | - } else { |
178 | | - // if it isnt allowed url |
179 | | - // tell user url is not allowed |
180 | | - if(method.MessageAfterDeleteLink()) { |
181 | | - message.author.send(config.MessageOnDelete_4) |
182 | | - } |
183 | | - // If user has required permissions in channel |
184 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
185 | | - // then delete it |
186 | | - message.delete() |
187 | | - } else {} |
188 | | - } |
189 | | - } else { |
190 | | - // it's not an url |
191 | | - // do nothing |
192 | | - } |
193 | | - // Check if channel is allowed channel |
194 | | - } else if (message.channel.id === config.Allowed_Channel_5) { |
195 | | - // check if the message in allowed channel has url |
196 | | - if (method.containsUrl(message.content)) { |
197 | | - // check if url is allowed |
198 | | - if (method.isAllowedUrl5(message.content)) { |
199 | | - } else { |
200 | | - // if it isnt allowed url |
201 | | - // tell user url is not allowed |
202 | | - if(method.MessageAfterDeleteLink()) { |
203 | | - message.author.send(config.MessageOnDelete_5) |
204 | | - } |
205 | | - // If user has required permissions in channel |
206 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
207 | | - // then delete it |
208 | | - message.delete() |
209 | | - } else {} |
210 | | - } |
211 | | - } else { |
212 | | - // it's not an url |
213 | | - // do nothing |
214 | | - } |
215 | | - // Check if channel is allowed channel |
216 | | - } else if (message.channel.id === config.Allowed_Channel_6) { |
217 | | - // check if the message in allowed channel has url |
218 | | - if (method.containsUrl(message.content)) { |
219 | | - // check if url is allowed |
220 | | - if (method.isAllowedUrl6(message.content)) { |
221 | | - } else { |
222 | | - // if it isnt allowed url |
223 | | - // tell user url is not allowed |
224 | | - if(method.MessageAfterDeleteLink()) { |
225 | | - message.author.send(config.MessageOnDelete_6) |
226 | | - } |
227 | | - // If user has required permissions in channel |
228 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
229 | | - // then delete it |
230 | | - message.delete() |
231 | | - } else {} |
232 | | - } |
233 | | - } else { |
234 | | - // it's not an url |
235 | | - // do nothing |
236 | | - } |
237 | | - } |
238 | | - |
239 | | - else { |
240 | | - } |
241 | | -// Check if message is not in allowed channels |
242 | | -if (!((message.channel.id == config.Allowed_Channel_1) || (message.channel.id == config.Allowed_Channel_2) || (message.channel.id == config.Allowed_Channel_3) || (message.channel.id == config.Allowed_Channel_4) || (message.channel.id == config.Allowed_Channel_5) || (message.channel.id == config.Allowed_Channel_6))) { |
243 | | - // Check if message contains url |
244 | | - if (method.containsUrl(message.content)) { |
245 | | - // Check configuration |
246 | | - if(method.MessageAfterDeleteLink()) { |
247 | | - message.author.send(config.GlobalDeleteURL) |
248 | | - } |
249 | | - // If user has required permissions in channel |
250 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
251 | | - // then delete it |
252 | | - message.delete() |
253 | | - } else {} |
254 | | - } |
255 | | - } |
256 | | -}); |
257 | | -}; |
258 | | - |
259 | | - |
260 | | - |
261 | | -//////////////////////////////////////////////////// |
262 | | -//------------------------------------------------// |
263 | | -// Cleaning regular chat from bot commands // |
264 | | -//------------------------------------------------// |
265 | | -//////////////////////////////////////////////////// |
266 | | - |
267 | | -// If this feature is enabled (checks config) |
268 | | -if(method.DeletingCommands()) { |
269 | | - // On message event |
270 | | - refloow.on("message", (message) => { |
271 | | - |
272 | | - // Importing Blacklisted prefixes from config |
273 | | - let blacklisted = config.blacklisted; |
274 | | - |
275 | | - for (var i in blacklisted) { |
276 | | - // If message is command (contains prefix) |
277 | | - if (message.content.startsWith(blacklisted[i])) { |
278 | | - // Delete it |
279 | | - // If user has required permissions in channel |
280 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
281 | | - // Delete the message |
282 | | - message.delete() |
283 | | - // Check configuration |
284 | | - if(method.MessageAfterDelete()) { |
285 | | - // Message user if enabled |
286 | | - message.author.send(config.MessageAfterDelete); |
287 | | - } |
288 | | - } else {} |
289 | | - } |
290 | | - } |
291 | | - }); |
292 | | -} |
293 | | - |
294 | | -//////////////////////////////////////////////////// |
295 | | -//------------------------------------------------// |
296 | | -// Blacklisted words filter // |
297 | | -//------------------------------------------------// |
298 | | -//////////////////////////////////////////////////// |
299 | | - |
300 | | -// Is this feature enabled (checks config) |
301 | | -if(method.ChatFilterEnabled()) { |
302 | | - // On message event |
303 | | - refloow.on("message", (message) => { |
| 54 | +// Importing required files |
| 55 | +const method = require('./app/methods.js'); |
| 56 | +const package = require('./package.json'); |
| 57 | +const v = package.version; |
304 | 58 |
|
305 | | - // Importing words from config |
306 | | - let bannedwords = config.bannedwords; |
| 59 | +// Basic infomations display on startup |
307 | 60 |
|
308 | | - for (var i in bannedwords) { |
309 | | - // If message contains bad words |
310 | | - if (message.content.toLowerCase().includes(bannedwords[i])) { |
311 | | - // Delete it |
312 | | - // If user has required permissions in channel |
313 | | - if(message.guild.me.permissionsIn(message.channel).has("SEND_MESSAGES")) { |
314 | | - message.delete() |
315 | | - // Checks config |
316 | | - if(method.MessageAfterDeleteFilter()) { |
317 | | - // Messageu user if enabled |
318 | | - message.author.send(config.MessageAfterDelete_filter); |
319 | | - } |
320 | | - } else {} |
321 | | - } |
322 | | - } |
323 | | - }); |
324 | | -} |
| 61 | +console.log('8888888b. .d888888 '.cyan); |
| 62 | +console.log('888 Y88b d88P" 888 '.cyan); |
| 63 | +console.log('888 888 888 888 '.cyan); |
| 64 | +console.log('888 d88P .d88b. 888888888 .d88b. .d88b. 888 888 888'.cyan); |
| 65 | +console.log('8888888P" d8P Y8b888 888d88""88bd88""88b888 888 888'.cyan); |
| 66 | +console.log('888 T88b 88888888888 888888 888888 888888 888 888'.cyan); |
| 67 | +console.log('888 T88b Y8b. 888 888Y88..88PY88..88PY88b 888 d88P '.cyan); |
| 68 | +console.log('888 T88b "Y8888 888 888 "Y88P" "Y88P" "Y8888888P" \n\n\n'.cyan); |
| 69 | +console.log('/* Original work: Copyright (c) 2020-2021 Refloow All rights reserved. \n Code origin (Free GitHub publish): https://github.com/Refloow/Discord-Channel-Moderator*/\n'.cyan); |
| 70 | +console.log(`Verision v${v}`.cyan); |
| 71 | +console.log('Preparing code for launch'.cyan); |
| 72 | +console.log(''.red); |
| 73 | +console.log('Loading config file...\n\n'.green ); |
325 | 74 |
|
| 75 | +// Starting main app |
326 | 76 |
|
| 77 | +require('./app/app.js'); |
327 | 78 |
|
328 | | -//////////////////////////////////////////////////// |
329 | | -//------------------------------------------------// |
330 | | -// Logging in // |
331 | | -//------------------------------------------------// |
332 | | -//////////////////////////////////////////////////// |
333 | 79 |
|
334 | | -refloow.login(config.Discord_Login).catch(() => Console.error("| [Discord] |: Invalid Bot Login Token.")) |
| 80 | +// Checking for correct version (updates) for bot on github |
335 | 81 |
|
| 82 | + method.check() |
336 | 83 |
|
337 | 84 | // Copyright notice: |
338 | 85 |
|
|
0 commit comments