Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.98 KB | None | 0 0
  1. //تسوي الملفات ذي
  2. //antigreff.json
  3. //config.json
  4. //تحط بداخلها ذي القوسين {}
  5.  
  6.  
  7. let anti = JSON.parse(fs.readFileSync("./antigreff.json", "UTF8"));
  8. let config = JSON.parse(fs.readFileSync("./config.json", "UTF8"));
  9. client.on("message", message => {
  10. if(!message.channel.guild) return;
  11. let user = anti[message.guild.id+message.author.id]
  12. let num = message.content.split(" ").slice(1).join(" ");
  13. if(!anti[message.guild.id+message.author.id]) anti[message.guild.id+message.author.id] = {
  14. actions: 0
  15. }
  16. if(!config[message.guild.id]) config[message.guild.id] = {
  17. banLimit: 3,
  18. chaDelLimit: 3,
  19. roleDelLimit: 3,
  20. kickLimits: 3,
  21. roleCrLimits: 3,
  22. time: 30
  23. }
  24. if(message.content.startsWith(prefix + "limit")) {
  25.  
  26.  
  27. if(!message.member.hasPermission('MANAGE_GUILD')) return;
  28. if(message.content.startsWith(prefix + "limitbans")) {
  29. if(!num) return message.channel.send("**→ | Supply a number !");
  30. if(isNaN(num)) return message.channel.send("**→ | Supply a number !**");
  31. config[message.guild.id].banLimit = num;
  32. message.channel.send(`**→ | Changed bans limit to : ${config[message.guild.id].banLimit}.**`)
  33. }
  34. if(message.content.startsWith(prefix + "limitkicks")) {
  35. if(!num) return message.channel.send("**→ | Supply a number !**");
  36. if(isNaN(num)) return message.channel.send("**→ | Supply a number !**");
  37. config[message.guild.id].kickLimits = num;
  38. message.channel.send(`**→ | Changed kicks limit to : ${config[message.guild.id].kickLimits}.**`)
  39. }
  40. if(message.content.startsWith(prefix + "limitroleDelete")) {
  41. if(!num) return message.channel.send("**→ | Supply a number !**");
  42. if(isNaN(num)) return message.channel.send("**→ | Supply a number !**");
  43. config[message.guild.id].roleDelLimit = num;
  44. message.channel.send(`**→ | Changed Role Deleting limit to : ${config[message.guild.id].roleDelLimit}.**`)
  45. }
  46. if(message.content.startsWith(prefix + "limitroleCreate")) {
  47. if(!num) return message.channel.send("**→ | Supply a number !**");
  48. if(isNaN(num)) return message.channel.send("**→ | Supply a number !**");
  49. config[message.guild.id].roleCrLimits = num;
  50. message.channel.send(`**→ | Changed Role Creation limit to : ${config[message.guild.id].roleCrLimits}.**`)
  51. }
  52. if(message.content.startsWith(prefix + "limitchannelDelete")) {
  53. if(!num) return message.channel.send("**→ | Supply a number !**");
  54. if(isNaN(num)) return message.channel.send("**→ | Supply a number !**");
  55. config[message.guild.id].chaDelLimit = num;
  56. message.channel.send(`**→ | Changed Channel Deleting limit to : ${config[message.guild.id].chaDelLimit}.**`)
  57. }
  58. if(message.content.startsWith(prefix + "limittime")) {
  59. if(!num) return message.channel.send("**→ | Supply a number !**");
  60. if(isNaN(num)) return message.channel.send("**→ | Supply a number !**");
  61. config[message.guild.id].time = num;
  62. message.channel.send(`**→ | Changed Times limit to : ${config[message.guild.id].time}.**`)
  63. }
  64. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function(e) {
  65. if(e) throw e;
  66. });
  67. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function(e) {
  68. if(e) throw e;
  69. });
  70. }
  71. });
  72. client.on("channelDelete", async channel => {
  73. const entry1 = await channel.guild.fetchAuditLogs({
  74. type: 'CHANNEL_DELETE'
  75. }).then(audit => audit.entries.first())
  76. console.log(entry1.executor.username)
  77. const entry = entry1.executor
  78. if (!config[channel.guild.id]) config[channel.guild.id] = {
  79. banLimit: 3,
  80. chaDelLimit: 3,
  81. roleDelLimit: 3,
  82. kickLimits: 3,
  83. roleCrLimits: 3
  84. }
  85. if (!anti[channel.guild.id + entry.id]) {//Zine , Mohamed Tarek , Kbosh
  86. anti[channel.guild.id + entry.id] = {
  87. actions: 1
  88. }
  89. setTimeout(() => {
  90. anti[channel.guild.id + entry.id].actions = "0"
  91. }, config[channel.guild.id].time * 1000)
  92. } else {
  93. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)//Zine , Mohamed Tarek , Kbosh
  94. console.log("TETS");
  95. setTimeout(() => {
  96. anti[channel.guild.id + entry.id].actions = "0"
  97. }, config[channel.guild.id].time * 1000)
  98. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].chaDelLimit) {
  99. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**→ | ${entry.username} , Deleted many __Channles__.**`))
  100. anti[channel.guild.id + entry.id].actions = "0"
  101. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  102. if (e) throw e;
  103. });
  104. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  105. if (e) throw e;
  106. });
  107. }
  108. }
  109.  
  110. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  111. if (e) throw e;
  112. });
  113. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  114. if (e) throw e;
  115. });
  116. });
  117.  
  118. client.on("roleDelete", async channel => {
  119. const entry1 = await channel.guild.fetchAuditLogs({
  120. type: 'ROLE_DELETE'
  121. }).then(audit => audit.entries.first())
  122. console.log(entry1.executor.username)
  123. const entry = entry1.executor
  124. if (!config[channel.guild.id]) config[channel.guild.id] = {
  125. banLimit: 3,
  126. chaDelLimit: 3,
  127. roleDelLimit: 3,
  128. kickLimits: 3,
  129. roleCrLimits: 3
  130. }
  131. if (!anti[channel.guild.id + entry.id]) {
  132. anti[channel.guild.id + entry.id] = {
  133. actions: 1
  134. }
  135. setTimeout(() => {
  136. anti[channel.guild.id + entry.id].actions = "0"
  137. }, config[channel.guild.id].time * 1000)
  138. } else {
  139. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
  140. console.log("TETS");
  141. setTimeout(() => {
  142. anti[channel.guild.id + entry.id].actions = "0"
  143. }, config[channel.guild.id].time * 1000)
  144. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].roleDelLimit) {
  145. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**→ | ${entry.username} , Deleted many __Roles__!**`))
  146. anti[channel.guild.id + entry.id].actions = "0"
  147. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  148. if (e) throw e;
  149. });
  150. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  151. if (e) throw e;
  152. });
  153. }
  154. }
  155.  
  156. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  157. if (e) throw e;
  158. });
  159. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  160. if (e) throw e;
  161. });
  162. });
  163.  
  164. client.on("roleCreate", async channel => {
  165. const entry1 = await channel.guild.fetchAuditLogs({
  166. type: 'ROLE_CREATE'
  167. }).then(audit => audit.entries.first())
  168. console.log(entry1.executor.username)
  169. const entry = entry1.executor
  170. if (!config[channel.guild.id]) config[channel.guild.id] = {
  171. banLimit: 3,
  172. chaDelLimit: 3,
  173. roleDelLimit: 3,
  174. kickLimits: 3,
  175. roleCrLimits: 3
  176. }
  177. if (!anti[channel.guild.id + entry.id]) {
  178. anti[channel.guild.id + entry.id] = {
  179. actions: 1
  180. }
  181. setTimeout(() => {
  182. anti[channel.guild.id + entry.id].actions = "0"
  183. }, config[channel.guild.id].time * 1000)
  184. } else {
  185. anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
  186. console.log("TETS");
  187. setTimeout(() => {
  188. anti[channel.guild.id + entry.id].actions = "0"
  189. }, config[channel.guild.id].time * 1000)
  190. if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].roleCrLimits) {
  191. channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**→ | ${entry.username} , is creating many __Rooms__.**`))
  192. anti[channel.guild.id + entry.id].actions = "0"
  193. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  194. if (e) throw e;
  195. });
  196. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  197. if (e) throw e;
  198. });
  199. }
  200. }
  201.  
  202. fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
  203. if (e) throw e;
  204. });
  205. fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
  206. if (e) throw e;
  207. });
  208. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement