Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.50 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 + "settings limits")) {
  19.  
  20.  
  21. if (!message.member.hasPermission('MANAGE_GUILD')) return;
  22. if (message.content.startsWith(prefix + "settings limitsban")) {
  23. if (!num) return message.channel.send("**? | ban limit ! **");
  24. if (isNaN(num)) return message.channel.send("**? | ban limit! **");
  25. config[message.guild.id].banLimit = num;
  26. message.channel.send(`**? | ban limit : ${config[message.guild.id].banLimit} **`)
  27. }
  28. if (message.content.startsWith(prefix + "settings 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(`**? | kick limit : ${config[message.guild.id].kickLimits}**`)
  33. }
  34. if (message.content.startsWith(prefix + "settings 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(`**? | role delete limit : ${config[message.guild.id].roleDelLimit}**`)
  39. }
  40. if (message.content.startsWith(prefix + "settings 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(`**? | role create limit : ${config[message.guild.id].roleCrLimits}**`)
  45. }
  46. if (message.content.startsWith(prefix + "settings 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(`**? | channel delete limit : ${config[message.guild.id].chaDelLimit}**`)
  51. }
  52. if (message.content.startsWith(prefix + "settings 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(`**? | time limits : ${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. client.on("channelDelete", async channel => {
  67. const entry1 = await channel.guild.fetchAuditLogs({
  68. type: 'CHANNEL_DELETE'
  69. }).then(audit => audit.entries.first())
  70. console.log(entry1.executor.username)
  71. const entry = entry1.executor
  72. if (!config[channel.guild.id]) config[channel.guild.id] = {
  73. banLimit: 3,
  74. chaDelLimit: 3,
  75. roleDelLimit: 3,
  76. kickLimits: 3,
  77. roleCrLimits: 3
  78. }
  79. if (!anti[channel.guild.id + entry.id]) {
  80. anti[channel.guild.id + entry.id] = {
  81. actions: 1
  82. }
  83. setTimeout(() => {
  84. anti[channel.guild.id + entry.id].actions = "0"
  85. }, config[channel.guild.id].time * 1000)
  86. } else {
  87. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
  88. console.log("TETS");
  89. setTimeout(() => {
  90. anti[channel.guild.id + entry.id].actions = "0"
  91. }, config[channel.guild.id].time * 1000)
  92. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].chaDelLimit) {
  93. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**? | ${entry.username} ÞÇã ÈãÓÍ ÇáßËíÑ ãä ÇáÑæãÇÊ **`))
  94. anti[channel.guild.id + entry.id].actions = "0"
  95. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  96. if (e) throw e;
  97. });
  98. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  99. if (e) throw e;
  100. });
  101. }
  102. }
  103.  
  104. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  105. if (e) throw e;
  106. });
  107. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  108. if (e) throw e;
  109. });
  110. });
  111.  
  112. client.on("roleDelete", async channel => {
  113. const entry1 = await channel.guild.fetchAuditLogs({
  114. type: 'ROLE_DELETE'
  115. }).then(audit => audit.entries.first())
  116. console.log(entry1.executor.username)
  117. const entry = entry1.executor
  118. if (!config[channel.guild.id]) config[channel.guild.id] = {
  119. banLimit: 3,
  120. chaDelLimit: 3,
  121. roleDelLimit: 3,
  122. kickLimits: 3,
  123. roleCrLimits: 3
  124. }
  125. if (!anti[channel.guild.id + entry.id]) {
  126. anti[channel.guild.id + entry.id] = {
  127. actions: 1
  128. }
  129. setTimeout(() => {
  130. anti[channel.guild.id + entry.id].actions = "0"
  131. }, config[channel.guild.id].time * 1000)
  132. } else {
  133. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
  134. console.log("TETS");
  135. setTimeout(() => {
  136. anti[channel.guild.id + entry.id].actions = "0"
  137. }, config[channel.guild.id].time * 1000)
  138. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].roleDelLimit) {
  139. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**? | ${entry.username} ÞÇã ÈãÓÍ ÇáßËíÑ ãä ÇáÑÊÈ **`))
  140. anti[channel.guild.id + entry.id].actions = "0"
  141. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  142. if (e) throw e;
  143. });
  144. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  145. if (e) throw e;
  146. });
  147. }
  148. }
  149.  
  150. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  151. if (e) throw e;
  152. });
  153. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  154. if (e) throw e;
  155. });
  156. });
  157.  
  158. client.on("roleCreate", async channel => {
  159. const entry1 = await channel.guild.fetchAuditLogs({
  160. type: 'ROLE_CREATE'
  161. }).then(audit => audit.entries.first())
  162. console.log(entry1.executor.username)
  163. const entry = entry1.executor
  164. if (!config[channel.guild.id]) config[channel.guild.id] = {
  165. banLimit: 3,
  166. chaDelLimit: 3,
  167. roleDelLimit: 3,
  168. kickLimits: 3,
  169. roleCrLimits: 3
  170. }
  171. if (!anti[channel.guild.id + entry.id]) {
  172. anti[channel.guild.id + entry.id] = {
  173. actions: 1
  174. }
  175. setTimeout(() => {
  176. anti[channel.guild.id + entry.id].actions = "0"
  177. }, config[channel.guild.id].time * 1000)
  178. } else {
  179. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
  180. console.log("TETS");
  181. setTimeout(() => {
  182. anti[channel.guild.id + entry.id].actions = "0"
  183. }, config[channel.guild.id].time * 1000)
  184. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].roleCrLimits) {
  185. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**? | ${entry.username} ÞÇã ÈÃäÔÇÁ ÇáßËíÑ ãä ÇáÑÊÈ **`))
  186. anti[channel.guild.id + entry.id].actions = "0"
  187. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  188. if (e) throw e;
  189. });
  190. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  191. if (e) throw e;
  192. });
  193. }
  194. }
  195.  
  196. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  197. if (e) throw e;
  198. });
  199. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  200. if (e) throw e;
  201. });
  202. });
  203.  
  204. client.on("guildBanAdd", async (guild, user) => {
  205. const entry1 = await channel.guild.fetchAuditLogs({
  206. type: 'MEMBER_BAN_ADD'
  207. }).then(audit => audit.entries.first())
  208. console.log(entry1.executor.username)
  209. const entry = entry1.executor
  210. if (!config[guild.id]) config[guild.id] = {
  211. banLimit: 3,
  212. chaDelLimit: 3,
  213. roleDelLimit: 3,
  214. kickLimits: 3,
  215. roleCrLimits: 3
  216. }
  217. if (!anti[guild.id + entry.id]) {
  218. anti[guild.id + entry.id] = {
  219. actions: 1
  220. }
  221. setTimeout(() => {
  222. anti[guild.id + entry.id].actions = "0"
  223. }, config[guild.id].time * 1000)
  224. } else {
  225. anti[guild.id + entry.id].actions = Math.floor(anti[guild.id + entry.id].actions + 1)
  226. console.log("TETS");
  227. setTimeout(() => {
  228. anti[guild.id + entry.id].actions = "0"
  229. }, config[guild.id].time * 1000)
  230. if (anti[guild.id + entry.id].actions >= config[guild.id].banLimit) {
  231. channel.members.get(entry.id).ban().catch(e => channel.owner.send(`**? | ${entry.username} ÍÇæá ÍÙÑ ÌãíÚ ÇáÃÚÖÇÁ **`))
  232. anti[guild.id + entry.id].actions = "0"
  233. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  234. if (e) throw e;
  235. });
  236. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  237. if (e) throw e;
  238. });
  239. }
  240. }
  241.  
  242. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  243. if (e) throw e;
  244. });
  245. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  246. if (e) throw e;
  247. });
  248. });
  249.  
  250. client.on("guildKickAdd", async (guild, user) => {
  251. const entry1 = await channel.fetchAuditLogs({
  252. type: 'MEMBER_KICK'
  253. }).then(audit => audit.entries.first())
  254. console.log(entry1.executor.username)
  255. const entry = entry1.executor
  256. if (!config[guild.id]) config[guild.id] = {
  257. banLimit: 3,
  258. chaDelLimit: 3,
  259. roleDelLimit: 3,
  260. kickLimits: 3,
  261. roleCrLimits: 3
  262. }
  263. if (!anti[guild.id + entry.id]) {
  264. anti[guild.id + entry.id] = {
  265. actions: 1
  266. }
  267. setTimeout(() => {
  268. anti[guild.id + entry.id].actions = "0"
  269. }, config[guild.id].time * 1000)
  270. } else {
  271. anti[guild.id + entry.id].actions = Math.floor(anti[guild.id + entry.id].actions + 1)
  272. console.log("TETS");
  273. setTimeout(() => {
  274. anti[guild.id + entry.id].actions = "0"
  275. }, config[guild.id].time * 1000)
  276. if (anti[guild.id + entry.id].actions >= config[guild.id].banLimit) {
  277. channel.members.get(entry.id).ban().catch(e => channel.owner.send(`**? | ${entry.username} ÍÇæá ÍÙÑ ÌãíÚ ÇáÃÚÖÇÁ **`))
  278. anti[guild.id + entry.id].actions = "0"
  279. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  280. if (e) throw e;
  281. });
  282. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  283. if (e) throw e;
  284. });
  285. }
  286. }
  287.  
  288. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  289. if (e) throw e;
  290. });
  291. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  292. if (e) throw e;
  293. });
  294. });
  295.  
  296. client.on("guildMemberRemove", async member => {
  297. const entry1 = await member.guild.fetchAuditLogs().then(audit => audit.entries.first())
  298. if (entry1.action === "MEMBER_KICK") {
  299. const entry2 = await member.guild.fetchAuditLogs({
  300. type: "MEMBER_KICK"
  301. }).then(audit => audit.entries.first())
  302. const entry = entry2.executor;
  303. if (!config[member.guild.id]) config[guild.id] = {
  304. banLimit: 3,
  305. chaDelLimit: 3,
  306. roleDelLimit: 3,
  307. kickLimits: 3,
  308. roleCrLimits: 3
  309. }
  310. if (!anti[member.guild.id + entry.id]) {
  311. anti[member.guild.id + entry.id] = {
  312. actions: 1
  313. }
  314. setTimeout(() => {
  315. anti[member.guild.id + entry.id].actions = "0"
  316. }, config[member.guild.id].time * 1000)
  317. } else {
  318. anti[member.guild.id + entry.id].actions = Math.floor(anti[member.guild.id + entry.id].actions + 1)
  319. console.log("TETS");
  320. setTimeout(() => {
  321. anti[member.guild.id + entry.id].actions = "0"
  322. }, config[member.guild.id].time * 1000)
  323. if (anti[member.guild.id + entry.id].actions >= config[member.guild.id].kickLimits) {
  324. member.members.get(entry.id).ban().catch(e => member.owner.send(`**? | ${entry.username} ÍÇæá ÍÙÑ ÌãíÚ ÇáÃÚÖÇÁ **`))
  325. anti[member.guild.id + entry.id].actions = "0"
  326. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  327. if (e) throw e;
  328. });
  329. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  330. if (e) throw e;
  331. });
  332. }
  333. }
  334.  
  335. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  336. if (e) throw e;
  337. });
  338. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  339. if (e) throw e;
  340. });
  341. }
  342.  
  343. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement