Fix For !hash

This commit is contained in:
MSFTserver 2017-09-26 11:34:22 -07:00 committed by GitHub
parent 10b27a5faf
commit 46593b280a

View file

@ -37,21 +37,22 @@ function respond(slackbot, data) {
function sendMiningInfo(slackbot, channel) { function sendMiningInfo(slackbot, channel) {
needle.get('https://explorer.lbry.io/api/getmininginfo', function(error, response) { needle.get('https://explorer.lbry.io/api/v1/status', function(error, response) {
if (error || response.statusCode !== 200) { if (error || response.statusCode !== 200) {
slackbot.postMessage(channel, 'Explorer API is not available'); slackbot.postMessage(channel, 'Explorer API is not available');
} }
else { else {
var data = response.body, var data, hashrate = "", difficulty = "", height = "";
hashrate = Math.round(data.networkhashps / 1000000000), data = response.body;
difficulty = numberWithCommas(Math.round(data.difficulty)), height += data.status.height;
block = numberWithCommas(data.blocks); hashrate += data.status.hashrate;
difficulty += data.status.difficulty;
slackbot.postMessage(channel, slackbot.postMessage(channel,
// 'Blockchain stats:\n' + // 'Blockchain stats:\n' +
'Hashrate: ' + hashrate + ' GH/s\n' + 'Hashrate: ' + hashrate + '\n' +
'Difficulty: ' + difficulty + '\n' + 'Difficulty: ' + difficulty + '\n' +
'Current block: ' + block + '\n' + 'Current block: ' + height + '\n' +
'_Source: https://explorer.lbry.io_' '_Source: https://explorer.lbry.io_'
, {icon_emoji: ':miner:'}); , {icon_emoji: ':miner:'});
} }