Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- console.log("The bot has been successfully injected on " + document.URL);
- var group_id = 0;
- var wait_time = 7.5; // In seconds
- var game_ids = global_var_an_games.split(",");
- console.log(game_ids);
- var accounts = ['xxjasonthegamer765xx','fire13574','fashionemily6095','Starchris325','marinesailerxx','DaisyPrincess92','Emperoralex67','flyerkyler','aliafan32','crazygamerxx06'];
- var account_pass = 'Thisisnotasecurepassword';
- var players_in_game = [];
- var usernames = [];
- var times_invoked = 0; // Ehh becuz 2 lazy to create find value and get index
- var header_dump = global_var_an_subject;
- var message_dump = global_var_an_message;
- // Adding custom function to arrays
- Array.prototype.random = function () {
- return this[Math.floor(Math.random() * this.length)];
- };
- (function invoke_bot(index) {
- get_players(game_ids[index], index);
- if (index++ < game_ids.length && typeof game_ids[index] !== "undefined") {
- invoke_bot(index);
- }
- })(0);
- function get_players(id) {
- (function get_data_dump(link_index) {
- $.ajax({
- url: 'https://www.roblox.com/games/getgameinstancesjson?placeId=' + id + '&startindex=' + link_index,
- type: 'GET',
- complete: function(dump_data, was_success) {
- if (was_success == 'success') {
- var parsed_data = JSON.parse(dump_data.responseText);
- var collection_dump = parsed_data.Collection;
- if (collection_dump.length > 0) {
- collection_dump.forEach(function(server) {
- var server_data = server.CurrentPlayers;
- if (server_data.length > 0) {
- server_data.forEach(function(player) {
- var player_id = player.Id;
- if (player_id > 0) {
- players_in_game.push(player_id);
- usernames.push(player.Username);
- }
- });
- }
- });
- }
- if (link_index < parsed_data.TotalCollectionSize) {
- get_data_dump(link_index + 10);
- } else {
- times_invoked++;
- console.log("Collection complete for game with ID " + id);
- if (times_invoked == game_ids.length) {
- run_bot();
- }
- }
- } else {
- console.log("You shouldn't be seeing this message as this api shouldn't be breaking.");
- }
- }
- });
- })(0);
- }
- function run_bot() {
- console.log("Boot up has finished. Now proceeding to send messages. Number of players: " + players_in_game.length);
- var players_per_bot = Math.floor(players_in_game.length / accounts.length);
- (function log_accounts(num) {
- var account = accounts[num];
- var minimum = num * players_per_bot;
- var players_to_send_to = [];
- var usernames_to_get = [];
- for (player = 0; player < players_per_bot && player < players_in_game.length; player++) {
- player_to_add = players_in_game.pop();
- username_to_add = usernames.pop();
- players_to_send_to.push(player_to_add);
- usernames_to_get.push(username_to_add);
- }
- wait_until_logged = log_in(account, account_pass);
- (function initiate_program(player) {
- setTimeout(function() {
- target_player = players_to_send_to[player];
- is_in_group(target_player, usernames_to_get[player]);
- player++;
- if (player < players_to_send_to.length && players_to_send_to[player]) {
- initiate_program(player);
- } else if (player >= players_to_send_to.length && num++ < accounts.length && accounts[num]) {
- log_accounts(num);
- }
- }, wait_time * 1000);
- })(0);
- })(0);
- }
- function log_in(user_name, pass_word) {
- $.ajax({
- url: 'https://www.roblox.com/MobileAPI/Login',
- type: 'POST',
- data: {
- username: user_name,
- password: pass_word
- },
- complete:function(ajax_data, was_success) {
- ajax_parsed = JSON.parse(ajax_data.responseText);
- if (ajax_parsed.Status == "BadCookieTryAgain") {
- log_in(user_name, pass_word);
- }
- }
- });
- }
- function is_in_group(userId, userName) {
- $.ajax({
- url: 'https://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=' + userId + '&groupid=' + group_id,
- type: 'GET',
- }).done(function(ajax_data, was_success) {
- if (ajax_data.match('false') && was_success == 'success') {
- follow_player(userId, userName);
- // send_message(userId);
- } else {
- console.log(userId + " is already part of the group.");
- }
- });
- }
- function follow_player(userId, userName) {
- $.ajax({
- url: 'https://www.roblox.com/user/follow',
- type: 'POST',
- data: {
- targetUserId: userId
- },
- complete: function(ajax_data, was_success) {
- send_message(userId, userName);
- if (was_success == 'success') {
- console.log("Followed user with ID " + userId);
- } else {
- console.log("Unable to follow user with ID " + userId);
- }
- }
- });
- }
- function send_message(userId, userName) {
- var id_for_granted = game_ids.random();
- $.ajax({
- url: "https://www.roblox.com/place-thumbnails?params=%5B%7BplaceId:" + id_for_granted + "%7D%5D",
- type: 'GET',
- complete: function(data) {
- var data_parsed = JSON.parse(data.responseText);
- $.ajax({
- url: 'https://www.roblox.com/messages/send',
- data: {
- subject: header_dump.replace(/fullname/g, userName).replace(/shortname/g, userName.substring(0, 3)).replace(/placename/g, data_parsed[0].name),
- body: message_dump.replace(/fullname/g, userName).replace(/shortname/g, userName.substring(0, 3)).replace(/placename/g, data_parsed[0].name).replace(/RETURN/g, "\n"),
- recipientid: userId,
- cacheBuster: $.now
- },
- type: 'POST',
- complete: function(ajax_data, was_success) {
- console.log(ajax_data);
- unfollow_player(userId);
- if (was_success == 'success' && JSON.parse(ajax_data.responseText).success === true) {
- console.log("Sent message to " + userId);
- } else {
- console.log("Unable to send message to " + userId);
- players_in_game.unshift(userId);
- }
- }
- });
- }
- });
- }
- function unfollow_player(userId) {
- $.ajax({
- url: 'https://www.roblox.com/api/user/unfollow',
- type: 'POST',
- data: {
- targetUserId: userId
- },
- complete: function(ajax_data, was_success) {
- if (was_success !== 'success') {
- console.log("Unable to to unfollow user with ID " + userId + ". Please unfollow this user manually.");
- } else {
- console.log("Successfully unfollowed the user with ID " + userId);
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement