Spam Bot
SpamBot - UPDATED!
Hey Muchachos!
After a struggle of not finding any good spam bots, I got a suggestion: why not make one myself? I though I couldn't do it but after some time and effort, I finally created one.
This is a Realm Relay script. You need to be running on a proxy server for this to work.
Muchacho_Man, how do I use it?
There are 4 available commands. 2 of which are required for the bot to work. The commands are:
/spam1
/spam2
/sbot
/spamspd
Explanation: /spam1
This command sets your first spam message. You need to set both spam messages for the bot to work. The reason for this is if you have 1 message repeating itself, other players will not see it as a spam, they will only see the message twice before it is blocked from their client for a while.
Code:
USAGE: /spam1 message here Example: /spam1 Selling 1 life pot! // It is even possible to spam a command! Example: /spam1 /trade Bluenoser
The message that is set after that example would be "Selling 1 life pot!"
Result of using this commandⓘ
Errors you may receive:
Explanation: /spam2
This command is exactly like the first, except with a 2 instead of a 1.
Code:
Usage: /spam2 message here Example: /spam2 Selling energy staff for 5 UBHPs! // You can also use commands on /spam 2 as well. Example: /spam2 /trade T
Errors you may receive:
Explanation: /sbot
This command activates the spamming. You will get a notification that contains your error if you are using this incorrectly. You need to have /spam1 and /spam2 set to use this command. Otherwise, it will tell you that messages are not set.
Code:
Usage: /sbot Example: /sbot
Result of using this commandⓘ
Errors you may receive:
Explanation: /spamspd
This command sets the speed each messages are sent at.
You cannot use:
- Negative Numbers
- Decimal Numbers
- Words
The number you are setting is the amount of seconds.
1 == 1 second.
The default speed is 1, therefore the speed is going at 1 message per second.
Code:
Usage: /spamspd seconds Example: /spamspd 1
Result of using this commandⓘ
Errors you may receive:
The Script
Code:
// spambot.js
// made by muchacho
$.echo('spambot.js loaded');
var ID_CREATE_SUCCESS = $.findPacketId('CREATE_SUCCESS');
var ID_NOTIFICATION = $.findPacketId('NOTIFICATION');
var ID_PLAYER_TEXT = $.findPacketId('PLAYERTEXT');
var ID_TEXT = $.findPacketId('TEXT');
var ID_UPDATE = $.findPacketId('UPDATE');
var enabled = false;
var playername = "";
var clientTime = 0;
var nextSpam = 0;
if (getter('spamdelay') == null) setter('spamdelay', 1000);
var currentmsg = true; // true = msg1 || false = msg2
function onClientPacket(event) {
var packet = event.getPacket();
if (packet.time != null) clientTime = packet.time;
if (clientTime >= nextSpam && enabled) playerSpam(event);
switch (packet.id()) {
case ID_PLAYER_TEXT: {
var text = packet.text;
var textLower = packet.text.toLowerCase();
if (textLower.substring(0,1) == '/') { // if text is a command
var commandSplit = textLower.split(' ');
var command = commandSplit[0].trim().slice(1);
switch(command) {
case 'sbot': {
event.cancel();
switch (enabled) {
case true: {
displaySpamNotification(event, 'Spambot Disabled.');
toggleSpam();
break;
}
case false: {
if (getter('msg1') != null && getter('msg2') != null) {
displaySpamNotification(event, 'Spambot Enabled.');
toggleSpam();
} else {
errorAlert(event, 'Messages not set.');
}
break;
}
}
break;
}
case 'spam1': {
event.cancel();
if (text.trim().length() <= 7) {
errorAlert(event, 'Enter a message!');
break;
}
var msg1content = text.slice(7);
if (msg1content.indexOf('"') >= 0) {
errorAlert(event, 'You cannot use double quotes!');
} else {
setter('msg1', msg1content);
displaySpamNotification(event, 'Message 1 set.');
}
break;
}
case 'spam2': {
event.cancel();
if (text.trim().length() <= 7) {
errorAlert(event, 'Enter a message!');
break;
}
var msg2content = text.substring(7, text.length());
if (msg2content.indexOf('"') >= 0) {
errorAlert(event, 'You cannot use double quotes!');
} else {
setter('msg2', msg2content);
displaySpamNotification(event, 'Message 2 set.');
}
break;
}
case 'spamspd': {
event.cancel();
if (text.trim().length() <= 9) {
errorAlert(event, 'Enter a value!');
break;
}
var spamspd = text.substring(9, text.length());
switch(isNaN(spamspd)) {
case true: {
errorAlert(event, 'That is not a number!');
break;
}
case false: {
if (spamspd % 1 != 0) {
errorAlert(event, 'Please choose an integer.');
} else if (spamspd < 0) {
errorAlert(event, 'Please choose a positive number.');
} else {
spamspd = spamspd * 1000;
setter('spamdelay', spamspd);
displaySpamNotification(event, 'Spam speed set.');
}
break;
}
}
break;
}
}
}
break;
}
}
}
function onServerPacket(event) {
var packet = event.getPacket();
if (packet.time != null) clientTime = packet.time;
if (clientTime >= nextSpam && enabled) playerSpam(event);
switch (packet.id()) {
case ID_CREATE_SUCCESS: {
playerObjectId = packet.objectId;
break;
}
case ID_UPDATE: {
for (var i in packet.newObjs)
if (packet.newObjs[i].status.objectId == playerObjectId)
for (var j in packet.newObjs[i].status.data)
if (packet.newObjs[i].status.data[j].obf0 == 31)
if (playername != null) playername = packet.newObjs[i].status.data[j].obf2;
break;
}
}
}
function getter(globalName) {
return $.getGlobal(globalName);
}
function setter(globalName, data) {
$.setGlobal(globalName, data);
}
function displaySpamNotification(event, content) {
var notificationPacket = event.createPacket(ID_NOTIFICATION);
notificationPacket.objectId = playerObjectId;
notificationPacket.message = '{"key":"blank","tokens":{"data":"' + content + '"}}';
notificationPacket.color = 0x00B000;
event.sendToClient(notificationPacket);
}
function playerSpam(event) {
var spamPacket = event.createPacket(ID_PLAYER_TEXT);
if (currentmsg) spamPacket.text = getter('msg1');
else spamPacket.text = getter('msg2');
toggleMsg();
nextSpam = clientTime + parseInt(getter('spamdelay'));
event.sendToServer(spamPacket);
}
function errorAlert(event, error) {
var errorPacket = event.createPacket(ID_TEXT);
errorPacket.name = '';
errorPacket.objectId = -1;
errorPacket.numStars = -1;
errorPacket.bubbleTime = 0;
errorPacket.recipient = '';
errorPacket.text = error;
errorPacket.cleanText = error;
event.sendToClient(errorPacket);
}
function toggleSpam() {
enabled = !enabled;
}
function toggleMsg() {
currentmsg = !currentmsg;
}
- Spam 2 different messages!
- You can even spam commands!
- Set the rate that you spam it!
- Enable / disable it any time!
- Great for USWest trading!
Instructions
Method 1:
- Make a new text file.
- Copy the code above, and paste it into the text file.
- Select 'Save As', and name it 'spambot.js' and locate to your RR/Scripts folder.
- Put the javascript file into the scripts folder, then start / restart your realm relay.
Method 2:
- Download the attached zip file.
- Locate to your realm relay scripts folder.
- Extract the RAR file into your scripts folder.
- Start / restart realm relay.
Updates:
- /spam1 and /spam2 are now global! You can set your spam1 and spam2 messages anywhere and they will stay until Realm Relay closes!
- Errors now come in text at the bottom left of your screen, similar to when you have an unrecognized command.
- Made code a lot more cleaner.
- Added error message for not entering a value on /spamspd.
- /spamspd is now global, you don't have to change it every time you enter a portal.
Plans:
- Auto trade bot!
- Any suggestions for the Spambot? PM me or post below!
Thanks sooo much to FainTMako for helping me on pretty much everything!
added new virus scans
https://www.virustotal.com/en/file/5...0ea4/analysis/ⓘ
http://virusscan.jotti.org/en/scanre...175fe3348b9102ⓘ


