Guest User

Untitled

a guest
Sep 1st, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. // anti-aa. uses nodejs; i havent actually tested it in the field yet
  2. const Roblox = require("noblox.js");
  3. const fetch = require("node-fetch");
  4.  
  5. const username = ""; // roblox bot name
  6. const pass = ""; // roblox bot pass
  7. const botRank = "O5 - X"; // rank name of bot's rank
  8. const suspRank = 5; // Rank id to demote users detected to have abused to
  9.  
  10. const webhookUrl = "";
  11.  
  12. const exemptUsers = [ // roblox user ids. will ignore these users
  13. 66592931, // Neztore
  14. 64798510
  15. ];
  16.  
  17. const userActions = new Map();
  18. const users = new Map();
  19. let punishedUsers = [];
  20.  
  21. setInterval(function(){
  22. console.log("Clearing user action logs.");
  23.  
  24. userActions.clear();
  25. users.clear();
  26. punishedUsers = [];
  27.  
  28. }, 3600000);
  29.  
  30. Roblox.login(username, pass).then(function(){
  31. setInterval(checkGroup, 20000);
  32.  
  33. })
  34. .catch(function(error){
  35. console.error(`Error logging in. Message: ${error.message}\n ${error}`);
  36. });
  37.  
  38. async function checkGroup(){
  39. // Do things :D
  40. let res = await Roblox.getAuditLog(3563533, 1);
  41.  
  42. // Iterate new array and total each user
  43. for (let log of res.logs) {
  44. let userId = log.user.id;
  45.  
  46. if (userActions.get(userId)) {
  47. userActions.set(userId, userActions.get(userId) + 1);
  48. } else {
  49. userActions.set(userId, 1);
  50. }
  51. if (!users.has(userId)) {
  52. users.set(userId, log.user);
  53. }
  54. }
  55.  
  56.  
  57. // look at totals
  58. for (let [key, value] of userActions) {
  59. if (value > 15) {
  60. let user = users.get(key);
  61. if (!exemptUsers.includes(user.id) && !punishedUsers.includes(user.id)) {
  62. console.log(`WARNING: User ${user.name} may be admin abusing!`);
  63. if (user.role !== "Administrator" && user.role !== botRank) {
  64. let error;
  65. try {
  66. let res = await Roblox.setRank(user.id, suspRank);
  67. punishedUsers.push(user.id);
  68. console.log(`User ${user.name} ranked to ${res.Name}.`);
  69. } catch(e) {
  70. error = e;
  71. }
  72.  
  73. // Send webhook msg
  74. let body = {
  75. content: "@-everyone - **ADMIN ABUSE DETECTED**. - THIS IS A DRILL/TEST.",
  76. tts: true, // super important; y not?!
  77. embeds: [],
  78. };
  79. if (error) {
  80. // send fail msg
  81. body.embeds.push({
  82. title: "WARNING: DE-RANK FAILED",
  83. color: 0xb3000a,
  84. description: `Attempted to de-rank user \`${user.name}\` but failed.\n**User Id**: ${user.id}\n**YOU MUST ENSURE THAT THIS USER IS NOT ABUSING.**`,
  85. fields: [{name: "Number of exiles/kicks/actions", value: `**User performed ${value} actions.**`}],
  86. timestamp: new Date()
  87. });
  88.  
  89. } else {
  90. // send ok msg
  91. body.embeds.push({
  92. title: "Attempted AA detected",
  93. color: 0xb3000a,
  94. description: `User \`${user.name}\` has been demoted to Class-E for suspected admin abuse.\n**User Id**: ${user.id}\n**The O5-Council must review this.**`,
  95. fields: [{name: "Number of exiles/kicks/actions", value: `**User performed ${value} actions.**`}],
  96. timestamp: new Date()
  97. });
  98. }
  99. let resp = await fetch(webhookUrl, {
  100. method: "POST",
  101. body: JSON.stringify(body),
  102. headers: {'Content-Type': 'application/json'}
  103. });
  104. if (resp.ok) {
  105. console.log("Sent webhook msg");
  106. } else {
  107. console.log("FAILED webhook msg");
  108. let j = await resp.json();
  109. console.error(j);
  110. }
  111. }
  112. } else {
  113. console.log(`Exempt user ${user.name} has a lot of audit activity.`);
  114. }
  115.  
  116. }
  117. }
  118.  
  119. }
  120.  
  121. // Neztore 2018
Add Comment
Please, Sign In to add comment