mirror of
https://github.com/LBRYFoundation/lbry-wunderbot.git
synced 2025-09-07 02:59:50 +00:00
Merge pull request #81 from MSFTserver/patch-4
fix hash bot when WTM api is down[done]
This commit is contained in:
commit
8baaae7cb5
1 changed files with 123 additions and 131 deletions
|
@ -20,8 +20,7 @@ exports.timedhash = function(bot) {
|
|||
needle.get('https://explorer.lbry.io/api/v1/status', function(error, response) {
|
||||
if (error || response.statusCode !== 200) {
|
||||
msg.channel.send('Explorer API is not available');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var data = response.body;
|
||||
var height = Number(data.status.height);
|
||||
var hashrate = data.status.hashrate;
|
||||
|
@ -29,7 +28,7 @@ needle.get('https://explorer.lbry.io/api/v1/status', function(error, response) {
|
|||
needle.get('https://whattomine.com/coins/164.json', function(error, response) {
|
||||
if (error || response.statusCode !== 200) {
|
||||
msg.channel.send('whattomine API is not available');
|
||||
} else {
|
||||
}
|
||||
var data = response.body;
|
||||
var reward = Number(data.block_reward);
|
||||
var block_time = Number(data.block_time);
|
||||
|
@ -52,7 +51,6 @@ needle.get('https://explorer.lbry.io/api/v1/status', function(error, response) {
|
|||
};
|
||||
bot.channels.get(ChannelID).send({ embed })
|
||||
return
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -80,7 +78,6 @@ exports.hash = {
|
|||
return
|
||||
}
|
||||
|
||||
|
||||
function sendMiningInfo(bot, msg, suffix) {
|
||||
if(!inPrivate(msg) && !hasHashBotChannels(msg)){
|
||||
msg.channel.send('Please use <#' + ChannelID + '> or DMs to talk to hash bot.');
|
||||
|
@ -89,8 +86,7 @@ function sendMiningInfo(bot, msg, suffix) {
|
|||
needle.get('https://explorer.lbry.io/api/v1/status', function(error, response) {
|
||||
if (error || response.statusCode !== 200) {
|
||||
msg.channel.send('Explorer API is not available');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var data = response.body;
|
||||
var height = Number(data.status.height);
|
||||
var hashrate = data.status.hashrate;
|
||||
|
@ -98,7 +94,7 @@ function sendMiningInfo(bot, msg, suffix) {
|
|||
needle.get('https://whattomine.com/coins/164.json', function(error, response) {
|
||||
if (error || response.statusCode !== 200) {
|
||||
msg.channel.send('whattomine API is not available');
|
||||
} else {
|
||||
}
|
||||
var data = response.body;
|
||||
var reward = Number(data.block_reward);
|
||||
var block_time = Number(data.block_time);
|
||||
|
@ -121,7 +117,6 @@ function sendMiningInfo(bot, msg, suffix) {
|
|||
};
|
||||
msg.channel.send({ embed });
|
||||
return
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -165,8 +160,5 @@ function sendProfitInfo(bot, msg, suffix) {
|
|||
function numberWithCommas(x) {
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue