Advertisement
VenoX-Dev

Untitled

Jun 17th, 2019
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.27 KB | None | 0 0
  1. let anti = JSON.parse(fs.readFileSync("./antigreff.json", "UTF8"));
  2. let config = JSON.parse(fs.readFileSync("./config.json", "UTF8"));
  3. client.on("message", message => {
  4. if (!message.channel.guild) return;
  5. let user = anti[message.guild.id + message.author.id]
  6. let num = message.content.split(" ").slice(2).join(" ");
  7. if (!anti[message.guild.id + message.author.id]) anti[message.guild.id + message.author.id] = {
  8. actions: 0
  9. }
  10. if (!config[message.guild.id]) config[message.guild.id] = {
  11. banLimit: 3,
  12. chaDelLimit: 3,
  13. roleDelLimit: 3,
  14. kickLimits: 3,
  15. roleCrLimits: 3,
  16. time: 30
  17. }
  18. if (message.content.startsWith(prefix + "limits")) {
  19.  
  20.  
  21. if (!message.member.hasPermission('MANAGE_GUILD')) return;
  22. if (message.content.startsWith(prefix + "limitsban")) {
  23. if (!num) return message.channel.send("**⇏ | أرسل رقم ! **");
  24. if (isNaN(num)) return message.channel.send("**⇏ | أرقام فقط ! **");
  25. config[message.guild.id].banLimit = num;
  26. message.channel.send(`**⇏ | تم التغيير اِلي : ${config[message.guild.id].banLimit} **`)
  27. }
  28. if (message.content.startsWith(prefix + "limitskick")) {
  29. if (!num) return message.channel.send("**⇏ | أرسل رقم ! **");
  30. if (isNaN(num)) return message.channel.send("**⇏ | أرقام فقط ! **");
  31. config[message.guild.id].kickLimits = num;
  32. message.channel.send(`**⇏ | تم التغيير اِلي : ${config[message.guild.id].kickLimits}**`)
  33. }
  34. if (message.content.startsWith(prefix + "limitsroleD")) {
  35. if (!num) return message.channel.send("**⇏ | أرسل رقم ! **");
  36. if (isNaN(num)) return message.channel.send("**⇏ | أرقام فقط ! **");
  37. config[message.guild.id].roleDelLimit = num;
  38. message.channel.send(`**⇏ | تم التغيير اِلي : ${config[message.guild.id].roleDelLimit}**`)
  39. }
  40. if (message.content.startsWith(prefix + "limitsroleC")) {
  41. if (!num) return message.channel.send("**⇏ | أرسل رقم ! **");
  42. if (isNaN(num)) return message.channel.send("**⇏ | أرقام فقط ! **");
  43. config[message.guild.id].roleCrLimits = num;
  44. message.channel.send(`**⇏ | تم التغيير اِلي : ${config[message.guild.id].roleCrLimits}**`)
  45. }
  46. if (message.content.startsWith(prefix + "limitschannelD")) {
  47. if (!num) return message.channel.send("**⇏ | أرسل رقم ! **");
  48. if (isNaN(num)) return message.channel.send("**⇏ | أرقام فقط ! **");
  49. config[message.guild.id].chaDelLimit = num;
  50. message.channel.send(`**⇏ | تم التغيير اِلي : ${config[message.guild.id].chaDelLimit}**`)
  51. }
  52. if (message.content.startsWith(prefix + "limitstime")) {
  53. if (!num) return message.channel.send("**⇏ | أرسل رقم ! **");
  54. if (isNaN(num)) return message.channel.send("**⇏ | أرقام فقط ! **");
  55. config[message.guild.id].time = num;
  56. message.channel.send(`**⇏ | تم التغيير اِلي : ${config[message.guild.id].time}**`)
  57. }
  58. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  59. if (e) throw e;
  60. });
  61. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  62. if (e) throw e;
  63. });
  64. }
  65. });
  66.  
  67. client.on("channelDelete", async channel => {
  68. const entry1 = await channel.guild.fetchAuditLogs({
  69. type: 'CHANNEL_DELETE'
  70. }).then(audit => audit.entries.first())
  71. console.log(entry1.executor.username)
  72. const entry = entry1.executor
  73. if (!config[channel.guild.id]) config[channel.guild.id] = {
  74. banLimit: 3,
  75. chaDelLimit: 3,
  76. roleDelLimit: 3,
  77. kickLimits: 3,
  78. roleCrLimits: 3
  79. }
  80. if (!anti[channel.guild.id + entry.id]) {
  81. anti[channel.guild.id + entry.id] = {
  82. actions: 1
  83. }
  84. setTimeout(() => {
  85. anti[channel.guild.id + entry.id].actions = "0"
  86. }, config[channel.guild.id].time * 1000)
  87. } else {
  88. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
  89. console.log("TETS");
  90. setTimeout(() => {
  91. anti[channel.guild.id + entry.id].actions = "0"
  92. }, config[channel.guild.id].time * 1000)
  93. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].chaDelLimit) {
  94. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**⇏ | ${entry.username} قام بمسح الكثير من الرومات **`))
  95. anti[channel.guild.id + entry.id].actions = "0"
  96. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  97. if (e) throw e;
  98. });
  99. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  100. if (e) throw e;
  101. });
  102. }
  103. }
  104.  
  105. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  106. if (e) throw e;
  107. });
  108. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  109. if (e) throw e;
  110. });
  111. });
  112.  
  113. client.on("roleDelete", async channel => {
  114. const entry1 = await channel.guild.fetchAuditLogs({
  115. type: 'ROLE_DELETE'
  116. }).then(audit => audit.entries.first())
  117. console.log(entry1.executor.username)
  118. const entry = entry1.executor
  119. if (!config[channel.guild.id]) config[channel.guild.id] = {
  120. banLimit: 3,
  121. chaDelLimit: 3,
  122. roleDelLimit: 3,
  123. kickLimits: 3,
  124. roleCrLimits: 3
  125. }
  126. if (!anti[channel.guild.id + entry.id]) {
  127. anti[channel.guild.id + entry.id] = {
  128. actions: 1
  129. }
  130. setTimeout(() => {
  131. anti[channel.guild.id + entry.id].actions = "0"
  132. }, config[channel.guild.id].time * 1000)
  133. } else {
  134. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
  135. console.log("TETS");
  136. setTimeout(() => {
  137. anti[channel.guild.id + entry.id].actions = "0"
  138. }, config[channel.guild.id].time * 1000)
  139. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].roleDelLimit) {
  140. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**⇏ | ${entry.username} قام بمسح الكثير من الرتب **`))
  141. anti[channel.guild.id + entry.id].actions = "0"
  142. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  143. if (e) throw e;
  144. });
  145. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  146. if (e) throw e;
  147. });
  148. }
  149. }
  150.  
  151. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  152. if (e) throw e;
  153. });
  154. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  155. if (e) throw e;
  156. });
  157. });
  158.  
  159. client.on("roleCreate", async channel => {
  160. const entry1 = await channel.guild.fetchAuditLogs({
  161. type: 'ROLE_CREATE'
  162. }).then(audit => audit.entries.first())
  163. console.log(entry1.executor.username)
  164. const entry = entry1.executor
  165. if (!config[channel.guild.id]) config[channel.guild.id] = {
  166. banLimit: 3,
  167. chaDelLimit: 3,
  168. roleDelLimit: 3,
  169. kickLimits: 3,
  170. roleCrLimits: 3
  171. }
  172. if (!anti[channel.guild.id + entry.id]) {
  173. anti[channel.guild.id + entry.id] = {
  174. actions: 1
  175. }
  176. setTimeout(() => {
  177. anti[channel.guild.id + entry.id].actions = "0"
  178. }, config[channel.guild.id].time * 1000)
  179. } else {
  180. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
  181. console.log("TETS");
  182. setTimeout(() => {
  183. anti[channel.guild.id + entry.id].actions = "0"
  184. }, config[channel.guild.id].time * 1000)
  185. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].roleCrLimits) {
  186. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**⇏ | ${entry.username} قام بأنشاء الكثير من الرتب **`))
  187. anti[channel.guild.id + entry.id].actions = "0"
  188. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  189. if (e) throw e;
  190. });
  191. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  192. if (e) throw e;
  193. });
  194. }
  195. }
  196.  
  197. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  198. if (e) throw e;
  199. });
  200. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  201. if (e) throw e;
  202. });
  203. });
  204.  
  205. client.on("guildBanAdd", async (guild, user) => {
  206. const entry1 = await channel.guild.fetchAuditLogs({
  207. type: 'MEMBER_BAN_ADD'
  208. }).then(audit => audit.entries.first())
  209. console.log(entry1.executor.username)
  210. const entry = entry1.executor
  211. if (!config[guild.id]) config[guild.id] = {
  212. banLimit: 3,
  213. chaDelLimit: 3,
  214. roleDelLimit: 3,
  215. kickLimits: 3,
  216. roleCrLimits: 3
  217. }
  218. if (!anti[guild.id + entry.id]) {
  219. anti[guild.id + entry.id] = {
  220. actions: 1
  221. }
  222. setTimeout(() => {
  223. anti[guild.id + entry.id].actions = "0"
  224. }, config[guild.id].time * 1000)
  225. } else {
  226. anti[guild.id + entry.id].actions = Math.floor(anti[guild.id + entry.id].actions + 1)
  227. console.log("TETS");
  228. setTimeout(() => {
  229. anti[guild.id + entry.id].actions = "0"
  230. }, config[guild.id].time * 1000)
  231. if (anti[guild.id + entry.id].actions >= config[guild.id].banLimit) {
  232. channel.members.get(entry.id).ban().catch(e => channel.owner.send(`**⇏ | ${entry.username} حاول حظر جميع الأعضاء **`))
  233. anti[guild.id + entry.id].actions = "0"
  234. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  235. if (e) throw e;
  236. });
  237. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  238. if (e) throw e;
  239. });
  240. }
  241. }
  242.  
  243. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  244. if (e) throw e;
  245. });
  246. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  247. if (e) throw e;
  248. });
  249. });
  250.  
  251. client.on("guildKickAdd", async (guild, user) => {
  252. const entry1 = await channel.fetchAuditLogs({
  253. type: 'MEMBER_KICK'
  254. }).then(audit => audit.entries.first())
  255. console.log(entry1.executor.username)
  256. const entry = entry1.executor
  257. if (!config[guild.id]) config[guild.id] = {
  258. banLimit: 3,
  259. chaDelLimit: 3,
  260. roleDelLimit: 3,
  261. kickLimits: 3,
  262. roleCrLimits: 3
  263. }
  264. if (!anti[guild.id + entry.id]) {
  265. anti[guild.id + entry.id] = {
  266. actions: 1
  267. }
  268. setTimeout(() => {
  269. anti[guild.id + entry.id].actions = "0"
  270. }, config[guild.id].time * 1000)
  271. } else {
  272. anti[guild.id + entry.id].actions = Math.floor(anti[guild.id + entry.id].actions + 1)
  273. console.log("TETS");
  274. setTimeout(() => {
  275. anti[guild.id + entry.id].actions = "0"
  276. }, config[guild.id].time * 1000)
  277. if (anti[guild.id + entry.id].actions >= config[guild.id].banLimit) {
  278. channel.members.get(entry.id).ban().catch(e => channel.owner.send(`**⇏ | ${entry.username} حاول حظر جميع الأعضاء **`))
  279. anti[guild.id + entry.id].actions = "0"
  280. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  281. if (e) throw e;
  282. });
  283. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  284. if (e) throw e;
  285. });
  286. }
  287. }
  288.  
  289. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  290. if (e) throw e;
  291. });
  292. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  293. if (e) throw e;
  294. });
  295. });
  296.  
  297. client.on("guildMemberRemove", async member => {
  298. const entry1 = await member.guild.fetchAuditLogs().then(audit => audit.entries.first())
  299. if (entry1.action === "MEMBER_KICK") {
  300. const entry2 = await member.guild.fetchAuditLogs({
  301. type: "MEMBER_KICK"
  302. }).then(audit => audit.entries.first())
  303. const entry = entry2.executor;
  304. if (!config[member.guild.id]) config[guild.id] = {
  305. banLimit: 3,
  306. chaDelLimit: 3,
  307. roleDelLimit: 3,
  308. kickLimits: 3,
  309. roleCrLimits: 3
  310. }
  311. if (!anti[member.guild.id + entry.id]) {
  312. anti[member.guild.id + entry.id] = {
  313. actions: 1
  314. }
  315. setTimeout(() => {
  316. anti[member.guild.id + entry.id].actions = "0"
  317. }, config[member.guild.id].time * 1000)
  318. } else {
  319. anti[member.guild.id + entry.id].actions = Math.floor(anti[member.guild.id + entry.id].actions + 1)
  320. console.log("TETS");
  321. setTimeout(() => {
  322. anti[member.guild.id + entry.id].actions = "0"
  323. }, config[member.guild.id].time * 1000)
  324. if (anti[member.guild.id + entry.id].actions >= config[member.guild.id].kickLimits) {
  325. member.members.get(entry.id).ban().catch(e => member.owner.send(`**⇏ | ${entry.username} حاول حظر جميع الأعضاء **`))
  326. anti[member.guild.id + entry.id].actions = "0"
  327. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  328. if (e) throw e;
  329. });
  330. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  331. if (e) throw e;
  332. });
  333. }
  334. }
  335.  
  336. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  337. if (e) throw e;
  338. });
  339. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  340. if (e) throw e;
  341. });
  342. }
  343. })
  344.  
  345. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement