Advertisement
Guest User

epic pm bot (for games)

a guest
Jul 25th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1.  
  2. var placeId = 292439477; // Place to check and message
  3. var waitTime = 0.5; // In seconds
  4. var group = 0; // 0 for no group check, otherwise people in this group will not receive the message
  5.  
  6. var origWaitTime = waitTime; // Do not edit!
  7.  
  8. function sendMsg(userId, username) {
  9. function send() {
  10. $.post("https://www.roblox.com/messages/send",{
  11. subject: 'Ascendant Forces | Invite Only',
  12. body: 'Hello, ' + username + '.\n\nI have been playing some games and I have discovered you are a very talented soldier!\nYou have been selected to become a great sword fighter.\nPlease, join us on AF (Ascendant Forces) today! We will find your best rank to start,\nand you get it for loyalty. We assist you in our trainings, and if something doesnt\nallow you to train,just PM Kimxia or CrimsonForce.\n\nYou can join us in this link: https://www.roblox.com/groups/group.aspx?gid=2588377\nThanks, the Admiral, ThugTwig\n\nP.S: I will reply to answer your questions.',
  13. recipientid: userId,
  14. cacheBuster: new Date().getTime()
  15. }).done(function(response) {
  16. if (response.success == true) {
  17. console.log('Sent message to ' + username + ' (' + userId + ')');
  18. waitTime = origWaitTime;
  19. } else {
  20. if (response.shortMessage == "SenderFlooded") {
  21. waitTime = origWaitTime * 5;
  22. } else {
  23. console.log('Error sending to ' + username + ': ' + response.shortMessage);
  24. }
  25. }
  26. });
  27. }
  28. if (group > 0) {
  29. $.get("https://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=" + userId + "&groupid=" + group, function(response) {
  30. if(response.indexOf('true') == -1) {
  31. send();
  32. } else {
  33. console.log('Didn\'t send a message to ' + username + ' because he is already in group ' + group + '.');
  34. }
  35. });
  36. } else {
  37. send();
  38. }
  39. }
  40.  
  41. var i=0;
  42. function run() {
  43. var timeout = 0;
  44. var url = "https://www.roblox.com/games/getgameinstancesjson?placeId=" + placeId +"&startindex=" + i*10;
  45. $.get(url).done(function(obj){
  46. for (var server in obj.Collection) {
  47. for (var players in obj.Collection[server].CurrentPlayers) {
  48. var plr = obj.Collection[server].CurrentPlayers[players];
  49. if (plr.Id > 0) {
  50. (function(time,id,name) {
  51. setTimeout(sendMsg,time,id,name);
  52. })(timeout,plr.Id,plr.Username);
  53. timeout+=waitTime*1000;
  54. }
  55. }
  56. }
  57. i++;
  58. setTimeout(run, timeout);
  59. });
  60. }
  61. run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement