Fix network command

This commit is contained in:
root 2017-10-03 00:58:43 +00:00
parent aad5389552
commit c39648a711
1 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import sopel.module
import requests import requests
import re import re
networkurl = "http://api.minexmr.com:8080/stats" networkurl = "http://node.xmrbackb.one:18081/getinfo"
@sopel.module.commands('fork', 'forkening') @sopel.module.commands('fork', 'forkening')
def fork(bot, trigger): def fork(bot, trigger):
@ -12,7 +12,7 @@ def fork(bot, trigger):
except Exception,e: except Exception,e:
pass pass
try: try:
height=j["network"]["height"] height=j["height"]
forkheight=1400000 forkheight=1400000
if forkheight > height: if forkheight > height:
bot.say("The current block height is {0:,}. Fork height is {1:,}. {2:,} blocks to go, happening in approximately {3:.2f} hours.".format(height,forkheight,forkheight-height,(forkheight-height)/30.0)) bot.say("The current block height is {0:,}. Fork height is {1:,}. {2:,} blocks to go, happening in approximately {3:.2f} hours.".format(height,forkheight,forkheight-height,(forkheight-height)/30.0))
@ -29,8 +29,8 @@ def network(bot, trigger):
except Exception,e: except Exception,e:
pass pass
try: try:
height=j["network"]["height"] height=j["height"]
diff=j["network"]["difficulty"] diff=j["difficulty"]
hashrate=float(diff)/120 hashrate=float(diff)/120
bot.say("The current block height is {0:,}. Difficulty is {1:,}. Hashrate is {2:.2f} Mh/s.".format(height,diff,hashrate/1e6)) bot.say("The current block height is {0:,}. Difficulty is {1:,}. Hashrate is {2:.2f} Mh/s.".format(height,diff,hashrate/1e6))
except: except: