Created
November 1, 2013 17:04
-
-
Save dariusc93/7268481 to your computer and use it in GitHub Desktop.
Before C++ plugin added
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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