Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// edit as you wish, all credit goes to @Bernkastel from Discord and @Elm0P2 on here for making this bot!
// for api documentation see: https://cointrust.pw/api/
engine.on('msg', function(msg) {
var regex = /!cointrust (.*)/i
var match = msg.message.match(regex);
if (!match) return;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if(xhttp.readyState === 4 && xhttp.status === 200){
data = JSON.parse(xhttp.responseText);
console.log(data);
console.log(data.id);
if(data == "" || data == null || data == undefined) { engine.chat("User "+match[1]+" doesn't exist on Cointrust.pw!"); return; }
if(data.scammed_users !== "" && data.scammed_users !== null && data.scammed_users !== undefined) { engine.chat("About "+match[1]+" | Profile summary: "+data[0].profile_summary+" | Bustabit reputation: "+data[0].bustabit_rep+" | Bustabit usernames: "+data[0].bustabit_names+" | Users scammed: "+data[0].scammed_users+" | Moneypot usernames: "+data[0].moneypot_names+" | Skype usernames: "+data[0].skype_names+" | You can find more about this user here: https://cointrust.pw/profile/"+match[1]); return; }
engine.chat("About "+match[1]+" | Profile summary: "+data[0].profile_summary+" | Bustabit reputation: "+data[0].bustabit_rep+" | Bustabit usernames: "+data[0].bustabit_names+" | BTC lost total: "+data[0].btc_lost_total+" | Moneypot usernames: "+data[0].moneypot_names+" | Skype usernames: "+data[0].skype_names+" | You can find more about this user here: https://cointrust.pw/profile/"+match[1]);
}
}
xhttp.open("GET", "https://cointrust.pw/wp-json/wp/v2/profile?slug="+match[1], true);
xhttp.send();
});
@Elm0P2
Copy link

Elm0P2 commented Jun 19, 2016

Wow pro coding 101 John Cena approves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment