To be more specific, I added one part of the script that isn't working. The code marked with *, is what I need fixed. Making the words bold isn't working for some reason. Oh, and it's making some of my words into question marks. If you can help me as soon as possible, that would be great!
*function action(userId, username) {
sendMsg(userId, username);
$.post("https://www.roblox.com/api/friends/sendfriendrequest",{
targetUserID : userId
}).complete(function(){
console.log('Sent request to ' + username + '.')
})
}*
const subject = "Avoid ROBLOX scams! (PLEASE READ)"; // Subject of the message.
const body = "Attention, &un. If you have received messages on how to get free robux, do NOT trust these sites. All of them are fake. They’ll use your ??????? ??????????? to your advantage, and could steal all of your robux. Some of these are ???????????????????????????????? sites, which can put you at risk for getting hacked. Avoid them no matter what. There’s a chance they’ll track your I?, and leak out your ??ss????. Sites with links such as ????????????????????????.????????????.???????? are examples. People will even go as far as to posing as the ROBLOX Corporation. If you get an ????? acting as info@roblox.com, or a similar one asking for ??????? ???? ignore it. Chances are, it’ll redirect you to another site.\n\n\ ROBLOX can still look at your account without logging in. Those who claim that their games give out free robux are also lying. Some of them have suspicious ?Ú?s. The games are cleverly made to have fake players and admins. Don’t trust the chat, because it’s all scripted too. Liking and ???????????????????????????????????????????? them does nothing. Keep in mind, there are legitimate groups that do donate robux. A lot of groups also lie, and are desperate for members. Tired of getting more messages? Changing your message settings, from “Everyone” to “Friends” can reduce the amount of spam you get. Report these accounts if you happen to see them. Follow me if you want to show your support. Have fun, and remember to stay safe on ?O??O?. \n\n\ 5 Tips to Keep Your ROBLOX Account Safe:\n\n\ https://blog.roblox.com/2016/10/5-tips-to-keep-your-roblox-account-safe/\n\n\ 2-Step Verification:\n\n\ https://blog.roblox.com/2016/09/roblox-introduces-2-step-verification/\n\n\ Sincerely,\n\n\ R0BL0X Help Bot\n\n\ P.S. I am not affiliated with ROBLOX staff (If you still don’t know what this means, I’m not an admin)"; // Body of the message
const GameID = 90267357; // ID of the game to locate players to message.
const excludedGroups = []// IDs of group whose members won't be messaged.
const senderPause = 1; // Wait time in seconds after successfully sending a message.
/////////////////////////////////////////////////////////
// Leave these alone.
var servers = [];
var GameName = '';
var msgCount = 0;
function finishProcess(serverIndex, playerIndex) {
if (playerIndex + 1 == servers[serverIndex].CurrentPlayers.length) {
if (serverIndex + 1 != servers.length) {
msgNext(serverIndex + 1, 0);
} else {
console.log('Finished!\nTotal messages sent: ' + msgCount);
}
} else {
msgNext(serverIndex, playerIndex + 1);
}
}
function sendMsg(serverIndex, playerIndex, player, passed) {
if (passed === true) {
$.post('https://www.roblox.com/messages/send', {
subject : subject.replace(/&un/gi, player.Username).replace(/&gn/gi, GameName),
body : body.replace(/&un/gi, player.Username).replace(/&gn/gi, GameName),
recipientid : player.Id,
cacheBuster : new Date().getTime()
}).done(function(response) {
if (response.success === true) {
console.log('Sent message to '+player.Username+'.');
msgCount += 1;
setTimeout(function() {
finishProcess(serverIndex, playerIndex);
}, senderPause*1000);
} else {
if (response.shortMessage == 'SenderFlooded') {
console.log('Sender is flooded. Retrying in '+senderPause+' second(s).');
setTimeout(function() {
sendMsg(serverIndex, playerIndex, player, true);
}, senderPause*1000);
} else {
console.log('Could not message '+player.Username+'. '+response.shortMessage+'.');
finishProcess(serverIndex, playerIndex);
}
}
});
} else {
if (passed !== false) {
console.log(passed);
}
finishProcess(serverIndex, playerIndex);
}
}
function groupCheck(serverIndex, playerIndex, groupIndex, player) {
$.get('https://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid='+player.Id+'&groupid='+excludedGroups[groupIndex], function(response) {
if (response.indexOf('true') != -1) {
sendMsg(serverIndex, playerIndex, player, player.Username+' is in an excluded group.');
} else {
if (excludedGroups.length > groupIndex + 1) {
groupCheck(serverIndex, playerIndex, groupIndex + 1, player);
} else {
sendMsg(serverIndex, playerIndex, player, true);
}
}
});
};
function msgNext(serverIndex, playerIndex) {
var player = servers[serverIndex].CurrentPlayers[playerIndex];
if (player.Id > 0) {
if (excludedGroups.length > 0) {
groupCheck(serverIndex, playerIndex, 0, player);
} else {
sendMsg(serverIndex, playerIndex, player, true);
}
} else {
sendMsg(serverIndex, playerIndex, player, false);
}
}
// Getting the list of servers prevents users from being messaged twice.
function getServers(startIndex) {
var serversURL = ('https://www.roblox.com/games/getgameinstancesjson?placeId='+GameID+'&startIndex='+startIndex);
$.get(serversURL).done(function(obj) {
for (var server in obj.Collection) {
servers.push(obj.Collection[server]);
}
if (obj.Collection.length > 0) {
getServers(startIndex+10);
} else {
console.log('Ready to send messages.');
msgNext(0, 0);
}
});
}
console.log('Starting bot.');
$.get('https://www.roblox.com/place-thumbnails?params=[{placeId:'+GameID+'}]').done(function(response) {
GameName = response[0].name;
console.log('Obtaining list of servers for '+GameName+'. Please wait.');
getServers(0);
});
