add lastblock with time
This commit is contained in:
parent
4d4272971d
commit
9589dae3b5
13
network.py
13
network.py
|
@ -1,6 +1,7 @@
|
||||||
import sopel.module
|
import sopel.module
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
# networkurl = "http://node.marty.cf:18019/getinfo"
|
# networkurl = "http://node.marty.cf:18019/getinfo"
|
||||||
# networkurl = "http://node.xmrbackb.one:18081/getinfo"
|
# networkurl = "http://node.xmrbackb.one:18081/getinfo"
|
||||||
|
@ -8,7 +9,7 @@ import re
|
||||||
# networkurl = "http://node.xmr.pt:18081/getinfo"
|
# networkurl = "http://node.xmr.pt:18081/getinfo"
|
||||||
networkurl = "http://node.supportxmr.com:18081/getinfo"
|
networkurl = "http://node.supportxmr.com:18081/getinfo"
|
||||||
|
|
||||||
jsonurl = "http://node.supportxmr.com:18081/json_rpc"
|
jsonurl = "http://node1.keepitmonero.com:18089/json_rpc"
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
}
|
}
|
||||||
|
@ -66,14 +67,14 @@ def mempool(bot, trigger):
|
||||||
|
|
||||||
@sopel.module.commands('lastblock')
|
@sopel.module.commands('lastblock')
|
||||||
def lastblock(bot, trigger):
|
def lastblock(bot, trigger):
|
||||||
try:
|
#try:
|
||||||
r=requests.get(lastblock)
|
# r=requests.get(lastblock)
|
||||||
r=requests.post(jsonurl, headers=headers, data=requestdata)
|
r=requests.post(jsonurl, headers=headers, data=requestdata)
|
||||||
j=r.json()
|
j=r.json()
|
||||||
block=j['result']['block_header']
|
block=j['result']['block_header']
|
||||||
bot.say("Last block height is {0} with {1} transactions".format(block['height'],block['num_txes']))
|
bot.say("Last block found {0:.2f} minutes ago with height {1} included {2} transactions".format((time.time() - float(block['timestamp']))/60, block['height'], block['num_txes']))
|
||||||
except:
|
#except:
|
||||||
bot.say("Something borked o_O")
|
# bot.say("Something borked o_O")
|
||||||
|
|
||||||
@sopel.module.commands('blocksize')
|
@sopel.module.commands('blocksize')
|
||||||
def blocksize(bot, trigger):
|
def blocksize(bot, trigger):
|
||||||
|
|
|
@ -18,6 +18,10 @@ def fourmatter(bot, trigger):
|
||||||
# bot.say('sun is not doing allah is doing')
|
# bot.say('sun is not doing allah is doing')
|
||||||
# bot.say('to accept Islam say that i bear witness that there is no deity worthy of worship except Allah and Muhammad peace be upon him is his slave and messenger')
|
# bot.say('to accept Islam say that i bear witness that there is no deity worthy of worship except Allah and Muhammad peace be upon him is his slave and messenger')
|
||||||
|
|
||||||
|
@sopel.module.commands('_.')
|
||||||
|
def faceflip(bot, trigger):
|
||||||
|
bot.say(':| .¯. |: ._. :| .¯. |: ._. :| .¯. |: ._.')
|
||||||
|
|
||||||
@sopel.module.commands('ada', 'hoskinson')
|
@sopel.module.commands('ada', 'hoskinson')
|
||||||
def ada(bot, trigger):
|
def ada(bot, trigger):
|
||||||
bot.say('DO YOU KNOW WHO I AM?')
|
bot.say('DO YOU KNOW WHO I AM?')
|
||||||
|
|
Loading…
Reference in New Issue