Merge pull request #178 from ykris45/patch-5

Fixed some variables
This commit is contained in:
filipnyquist 2018-06-02 20:38:47 +02:00 committed by GitHub
commit 4043fdb962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,18 +19,18 @@ exports.timedhash = function(bot) {
if (error || response.statusCode !== 200) { if (error || response.statusCode !== 200) {
msg.channel.send('Explorer API is not available'); msg.channel.send('Explorer API is not available');
} else { } else {
var data = response.body; let data = response.body;
var height = Number(data.status.height); let height = Number(data.status.height);
var hashrate = data.status.hashrate; let hashrate = data.status.hashrate;
var difficulty = Number(data.status.difficulty); let difficulty = Number(data.status.difficulty);
needle.get('https://whattomine.com/coins/164.json', function(error, response) { needle.get('https://whattomine.com/coins/164.json', function(error, response) {
if (error || response.statusCode !== 200) { if (error || response.statusCode !== 200) {
msg.channel.send('whattomine API is not available'); msg.channel.send('whattomine API is not available');
} }
var data = response.body; let data = response.body;
var reward = Number(data.block_reward); let reward = Number(data.block_reward);
var block_time = Number(data.block_time); let block_time = Number(data.block_time);
var difficulty24 = Number(data.difficulty24); let difficulty24 = Number(data.difficulty24);
description = description =
'Hashrate: ' + 'Hashrate: ' +
numberWithCommas(hashrate) + numberWithCommas(hashrate) +
@ -75,7 +75,7 @@ exports.hash = {
usage: '', usage: '',
description: 'Displays current Hashrate of Network\n**!hash power <Mh/s>**\n Displays potential Earnings For Given Hashrate', description: 'Displays current Hashrate of Network\n**!hash power <Mh/s>**\n Displays potential Earnings For Given Hashrate',
process: function(bot, msg, suffix) { process: function(bot, msg, suffix) {
var command = '!hash'; let command = '!hash';
words = suffix words = suffix
.trim() .trim()
.split(' ') .split(' ')
@ -101,18 +101,18 @@ exports.hash = {
if (error || response.statusCode !== 200) { if (error || response.statusCode !== 200) {
msg.channel.send('Explorer API is not available'); msg.channel.send('Explorer API is not available');
} else { } else {
var data = response.body; let data = response.body;
var height = Number(data.status.height); let height = Number(data.status.height);
var hashrate = data.status.hashrate; let hashrate = data.status.hashrate;
var difficulty = Number(data.status.difficulty); let difficulty = Number(data.status.difficulty);
needle.get('https://whattomine.com/coins/164.json', function(error, response) { needle.get('https://whattomine.com/coins/164.json', function(error, response) {
if (error || response.statusCode !== 200) { if (error || response.statusCode !== 200) {
msg.channel.send('whattomine API is not available'); msg.channel.send('whattomine API is not available');
} }
var data = response.body; let data = response.body;
var reward = Number(data.block_reward); let reward = Number(data.block_reward);
var block_time = Number(data.block_time); let block_time = Number(data.block_time);
var difficulty24 = Number(data.difficulty24); let difficulty24 = Number(data.difficulty24);
description = description =
'Hashrate: ' + 'Hashrate: ' +
numberWithCommas(hashrate) + numberWithCommas(hashrate) +
@ -159,18 +159,18 @@ exports.hash = {
.filter(function(n) { .filter(function(n) {
return n !== ''; return n !== '';
}); });
var myhashrate = words[1]; let myhashrate = words[1];
if (myhashrate == '' || myhashrate == null || myhashrate == undefined || myhashrate == ' ') { if (myhashrate == '' || myhashrate == null || myhashrate == undefined || myhashrate == ' ') {
myhashrate = '100'; myhashrate = '100';
} }
var Diff = response.body.difficulty24; let Diff = response.body.difficulty24;
var Reward = response.body.block_reward; let Reward = response.body.block_reward;
var myHash = Number(myhashrate); let myHash = Number(myhashrate);
var LBC = myHash / 2000 * (1 / ((Diff * 2) ^ 32) * Reward) * 3600; let LBC = myHash / 2000 * (1 / ((Diff * 2) ^ 32) * Reward) * 3600;
var LBC24 = myHash / 2000 * (1 / ((Diff * 2) ^ 32) * Reward) * 86400; let LBC24 = myHash / 2000 * (1 / ((Diff * 2) ^ 32) * Reward) * 86400;
var LBC1w = myHash / 2000 * (1 / ((Diff * 2) ^ 32) * Reward) * 604800; let LBC1w = myHash / 2000 * (1 / ((Diff * 2) ^ 32) * Reward) * 604800;
var LBC1m = myHash / 2000 * (1 / ((Diff * 2) ^ 32) * Reward) * 2628000; let LBC1m = myHash / 2000 * (1 / ((Diff * 2) ^ 32) * Reward) * 2628000;
var message = let message =
'With **' + 'With **' +
myHash + myHash +
' Mh/s** and Average 24 hour Difficulty: **' + ' Mh/s** and Average 24 hour Difficulty: **' +