var io = require('socket.io-client');
socket = io.connect("https://coinchat.org", {
secure: true
});
var username = "DMCFaucetBot";
var outputBuffer = [];
socket.on('connect', function () {
socket.emit('login', {
session: "removed"
});
socket.on('loggedin', function (data) {
username = data.username;
setTimeout(function () {
socket.emit("getcolors", {});
}, 1000);
setInterval(function () {
if (outputBuffer.length > 0) {
var chat = outputBuffer.splice(0, 1)[0];
socket.emit("chat", {
room: chat.room,
message: chat.message
});
}
}, 600);
});
socket.emit('joinroom', {
join: 'dmcfaucet'
});
socket.emit('joinroom', {
join: 'offtopic'
});
socket.on('chat', function (data) {
if (data.message === "!dmc admin terminate: faucet" && (data.room === "offtopic" || data.room === "dmcfaucet" ) && (data.user === "DiamondCardz" || data.user === "admin")) {
throw new Error();
}
});
socket.on('disconnect', function () {});
});
function contains(string, terms) {
for (var i = 0; i < terms.length; i++) {
if (string.toLowerCase().indexOf(terms[i].toLowerCase()) == -1) {
return false;
}
}
return true;
}