Skip to content

Instantly share code, notes, and snippets.

@dariusc93
Created November 1, 2013 17:04
Show Gist options
  • Save dariusc93/7268481 to your computer and use it in GitHub Desktop.
Save dariusc93/7268481 to your computer and use it in GitHub Desktop.
Before C++ plugin added
var irc = require('irc'),
http = require('http');//,
//ircsync = require('ircsync');
var bot = new irc.Client('irc.freenode.net', 'minelitecoin-bot', {channels: ['#mine-litecoin']});
bot.addListener('message', function(from, to, message){
if(message == '?help'){
bot.say('#mine-litecoin', 'If you need help with getting started visit http://mine-litecoin.com/index.php?page=getting%20started');
}
if(message == '?stat'){
var data = "";
var req = http.get('http://mine-litecoin.com/index.php?page=api&action=public', function(res){
res.on('data', function(chunk){
data += chunk;
});
res.on('end', function(){
console.log(data);
var stat = JSON.parse(data);
bot.say('#mine-litecoin', 'Pool:' + stat.pool_name);
bot.say('#mine-litecoin', 'Hashrate:'+ stat.hashrate + 'KH/s');
bot.say('#mine-litecoin', 'Workers:' + stat.workers);
bot.say('#mine-litecoin', 'Shares:' + stat.shares_this_round);
bot.say('#mine-litecoin', 'Last Block:' + stat.last_block);
});
});
}
if(message == '?ping'){bot.say('#mine-litecoin','pong');}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment