Advertisement
Guest User

1

a guest
Aug 10th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.72 KB | None | 0 0
  1. console.log("The bot has been successfully injected on " + document.URL);
  2. var group_id = 0;
  3. var wait_time = 7.5; // In seconds
  4. var game_ids = global_var_an_games.split(",");
  5. console.log(game_ids);
  6. var accounts = ['xxjasonthegamer765xx','fire13574','fashionemily6095','Starchris325','marinesailerxx','DaisyPrincess92','Emperoralex67','flyerkyler','aliafan32','crazygamerxx06'];
  7. var account_pass = 'Thisisnotasecurepassword';
  8. var players_in_game = [];
  9. var usernames = [];
  10. var times_invoked = 0; // Ehh becuz 2 lazy to create find value and get index
  11. var header_dump = global_var_an_subject;
  12. var message_dump = global_var_an_message;
  13. // Adding custom function to arrays
  14. Array.prototype.random = function () {
  15. return this[Math.floor(Math.random() * this.length)];
  16. };
  17.  
  18. (function invoke_bot(index) {
  19. get_players(game_ids[index], index);
  20. if (index++ < game_ids.length && typeof game_ids[index] !== "undefined") {
  21. invoke_bot(index);
  22. }
  23. })(0);
  24.  
  25. function get_players(id) {
  26. (function get_data_dump(link_index) {
  27. $.ajax({
  28. url: 'https://www.roblox.com/games/getgameinstancesjson?placeId=' + id + '&startindex=' + link_index,
  29. type: 'GET',
  30. complete: function(dump_data, was_success) {
  31. if (was_success == 'success') {
  32. var parsed_data = JSON.parse(dump_data.responseText);
  33. var collection_dump = parsed_data.Collection;
  34.  
  35. if (collection_dump.length > 0) {
  36. collection_dump.forEach(function(server) {
  37. var server_data = server.CurrentPlayers;
  38.  
  39. if (server_data.length > 0) {
  40. server_data.forEach(function(player) {
  41. var player_id = player.Id;
  42. if (player_id > 0) {
  43. players_in_game.push(player_id);
  44. usernames.push(player.Username);
  45. }
  46. });
  47. }
  48. });
  49. }
  50. if (link_index < parsed_data.TotalCollectionSize) {
  51. get_data_dump(link_index + 10);
  52. } else {
  53. times_invoked++;
  54. console.log("Collection complete for game with ID " + id);
  55. if (times_invoked == game_ids.length) {
  56. run_bot();
  57. }
  58. }
  59. } else {
  60. console.log("You shouldn't be seeing this message as this api shouldn't be breaking.");
  61. }
  62. }
  63. });
  64. })(0);
  65. }
  66.  
  67. function run_bot() {
  68. console.log("Boot up has finished. Now proceeding to send messages. Number of players: " + players_in_game.length);
  69. var players_per_bot = Math.floor(players_in_game.length / accounts.length);
  70.  
  71. (function log_accounts(num) {
  72. var account = accounts[num];
  73. var minimum = num * players_per_bot;
  74. var players_to_send_to = [];
  75. var usernames_to_get = [];
  76.  
  77. for (player = 0; player < players_per_bot && player < players_in_game.length; player++) {
  78. player_to_add = players_in_game.pop();
  79. username_to_add = usernames.pop();
  80.  
  81. players_to_send_to.push(player_to_add);
  82. usernames_to_get.push(username_to_add);
  83. }
  84.  
  85. wait_until_logged = log_in(account, account_pass);
  86.  
  87. (function initiate_program(player) {
  88. setTimeout(function() {
  89. target_player = players_to_send_to[player];
  90. is_in_group(target_player, usernames_to_get[player]);
  91. player++;
  92. if (player < players_to_send_to.length && players_to_send_to[player]) {
  93. initiate_program(player);
  94. } else if (player >= players_to_send_to.length && num++ < accounts.length && accounts[num]) {
  95. log_accounts(num);
  96. }
  97. }, wait_time * 1000);
  98. })(0);
  99. })(0);
  100. }
  101.  
  102. function log_in(user_name, pass_word) {
  103. $.ajax({
  104. url: 'https://www.roblox.com/MobileAPI/Login',
  105. type: 'POST',
  106. data: {
  107. username: user_name,
  108. password: pass_word
  109. },
  110. complete:function(ajax_data, was_success) {
  111. ajax_parsed = JSON.parse(ajax_data.responseText);
  112. if (ajax_parsed.Status == "BadCookieTryAgain") {
  113. log_in(user_name, pass_word);
  114. }
  115. }
  116. });
  117. }
  118.  
  119. function is_in_group(userId, userName) {
  120. $.ajax({
  121. url: 'https://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=' + userId + '&groupid=' + group_id,
  122. type: 'GET',
  123. }).done(function(ajax_data, was_success) {
  124. if (ajax_data.match('false') && was_success == 'success') {
  125. follow_player(userId, userName);
  126. // send_message(userId);
  127. } else {
  128. console.log(userId + " is already part of the group.");
  129. }
  130. });
  131. }
  132.  
  133. function follow_player(userId, userName) {
  134. $.ajax({
  135. url: 'https://www.roblox.com/user/follow',
  136. type: 'POST',
  137. data: {
  138. targetUserId: userId
  139. },
  140. complete: function(ajax_data, was_success) {
  141. send_message(userId, userName);
  142. if (was_success == 'success') {
  143. console.log("Followed user with ID " + userId);
  144. } else {
  145. console.log("Unable to follow user with ID " + userId);
  146. }
  147. }
  148. });
  149. }
  150.  
  151. function send_message(userId, userName) {
  152. var id_for_granted = game_ids.random();
  153. $.ajax({
  154. url: "https://www.roblox.com/place-thumbnails?params=%5B%7BplaceId:" + id_for_granted + "%7D%5D",
  155. type: 'GET',
  156. complete: function(data) {
  157. var data_parsed = JSON.parse(data.responseText);
  158.  
  159. $.ajax({
  160. url: 'https://www.roblox.com/messages/send',
  161. data: {
  162. subject: header_dump.replace(/fullname/g, userName).replace(/shortname/g, userName.substring(0, 3)).replace(/placename/g, data_parsed[0].name),
  163. 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"),
  164. recipientid: userId,
  165. cacheBuster: $.now
  166. },
  167. type: 'POST',
  168. complete: function(ajax_data, was_success) {
  169. console.log(ajax_data);
  170. unfollow_player(userId);
  171. if (was_success == 'success' && JSON.parse(ajax_data.responseText).success === true) {
  172. console.log("Sent message to " + userId);
  173. } else {
  174. console.log("Unable to send message to " + userId);
  175. players_in_game.unshift(userId);
  176. }
  177. }
  178. });
  179. }
  180. });
  181. }
  182.  
  183. function unfollow_player(userId) {
  184. $.ajax({
  185. url: 'https://www.roblox.com/api/user/unfollow',
  186. type: 'POST',
  187. data: {
  188. targetUserId: userId
  189. },
  190. complete: function(ajax_data, was_success) {
  191. if (was_success !== 'success') {
  192. console.log("Unable to to unfollow user with ID " + userId + ". Please unfollow this user manually.");
  193. } else {
  194. console.log("Successfully unfollowed the user with ID " + userId);
  195. }
  196. }
  197. });
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement