Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // anti-aa. uses nodejs; i havent actually tested it in the field yet
- const Roblox = require("noblox.js");
- const fetch = require("node-fetch");
- const username = ""; // roblox bot name
- const pass = ""; // roblox bot pass
- const botRank = "O5 - X"; // rank name of bot's rank
- const suspRank = 5; // Rank id to demote users detected to have abused to
- const webhookUrl = "";
- const exemptUsers = [ // roblox user ids. will ignore these users
- 66592931, // Neztore
- 64798510
- ];
- const userActions = new Map();
- const users = new Map();
- let punishedUsers = [];
- setInterval(function(){
- console.log("Clearing user action logs.");
- userActions.clear();
- users.clear();
- punishedUsers = [];
- }, 3600000);
- Roblox.login(username, pass).then(function(){
- setInterval(checkGroup, 20000);
- })
- .catch(function(error){
- console.error(`Error logging in. Message: ${error.message}\n ${error}`);
- });
- async function checkGroup(){
- // Do things :D
- let res = await Roblox.getAuditLog(3563533, 1);
- // Iterate new array and total each user
- for (let log of res.logs) {
- let userId = log.user.id;
- if (userActions.get(userId)) {
- userActions.set(userId, userActions.get(userId) + 1);
- } else {
- userActions.set(userId, 1);
- }
- if (!users.has(userId)) {
- users.set(userId, log.user);
- }
- }
- // look at totals
- for (let [key, value] of userActions) {
- if (value > 15) {
- let user = users.get(key);
- if (!exemptUsers.includes(user.id) && !punishedUsers.includes(user.id)) {
- console.log(`WARNING: User ${user.name} may be admin abusing!`);
- if (user.role !== "Administrator" && user.role !== botRank) {
- let error;
- try {
- let res = await Roblox.setRank(user.id, suspRank);
- punishedUsers.push(user.id);
- console.log(`User ${user.name} ranked to ${res.Name}.`);
- } catch(e) {
- error = e;
- }
- // Send webhook msg
- let body = {
- content: "@-everyone - **ADMIN ABUSE DETECTED**. - THIS IS A DRILL/TEST.",
- tts: true, // super important; y not?!
- embeds: [],
- };
- if (error) {
- // send fail msg
- body.embeds.push({
- title: "WARNING: DE-RANK FAILED",
- color: 0xb3000a,
- 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.**`,
- fields: [{name: "Number of exiles/kicks/actions", value: `**User performed ${value} actions.**`}],
- timestamp: new Date()
- });
- } else {
- // send ok msg
- body.embeds.push({
- title: "Attempted AA detected",
- color: 0xb3000a,
- 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.**`,
- fields: [{name: "Number of exiles/kicks/actions", value: `**User performed ${value} actions.**`}],
- timestamp: new Date()
- });
- }
- let resp = await fetch(webhookUrl, {
- method: "POST",
- body: JSON.stringify(body),
- headers: {'Content-Type': 'application/json'}
- });
- if (resp.ok) {
- console.log("Sent webhook msg");
- } else {
- console.log("FAILED webhook msg");
- let j = await resp.json();
- console.error(j);
- }
- }
- } else {
- console.log(`Exempt user ${user.name} has a lot of audit activity.`);
- }
- }
- }
- }
- // Neztore 2018
Add Comment
Please, Sign In to add comment