Compare commits

..

6 Commits

Author SHA1 Message Date
root 9589dae3b5 add lastblock with time 2021-03-30 18:02:24 +00:00
jw 4d4272971d
Merge pull request #56 from Keep-it-Monero/master
redo lastblock with jsonrpc post method
2021-03-30 13:43:24 -04:00
donkeydonkey 8457c35304 redo lastblock with jsonrpc post method 2021-03-30 10:41:48 -07:00
jw 7ae267ace2
Merge pull request #55 from Keep-it-Monero/master
add lastblock command
2021-03-30 12:46:17 -04:00
donkeydonkey 799f8d7dd0
give unique command name 2021-03-30 09:40:55 -07:00
donkeydonkey a10e4c32cb
add lastblock command 2021-03-30 09:20:43 -07:00
2 changed files with 22 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import sopel.module
import requests
import re
import time
# networkurl = "http://node.marty.cf:18019/getinfo"
# networkurl = "http://node.xmrbackb.one:18081/getinfo"
@ -8,6 +9,12 @@ import re
# networkurl = "http://node.xmr.pt:18081/getinfo"
networkurl = "http://node.supportxmr.com:18081/getinfo"
jsonurl = "http://node1.keepitmonero.com:18089/json_rpc"
headers = {
'Content-Type': 'application/json',
}
requestdata = '{"jsonrpc":"2.0","id":"0","method":"get_last_block_header"}'
@sopel.module.commands('fork', 'forkening')
def fork(bot, trigger):
try:
@ -57,6 +64,17 @@ def mempool(bot, trigger):
bot.say("The current number of txs in Monero's mempool is {0}".format(j['tx_pool_size']))
except:
bot.say("Something borked o_O")
@sopel.module.commands('lastblock')
def lastblock(bot, trigger):
#try:
# r=requests.get(lastblock)
r=requests.post(jsonurl, headers=headers, data=requestdata)
j=r.json()
block=j['result']['block_header']
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:
# bot.say("Something borked o_O")
@sopel.module.commands('blocksize')
def blocksize(bot, trigger):

View File

@ -18,6 +18,10 @@ def fourmatter(bot, trigger):
# 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')
@sopel.module.commands('_.')
def faceflip(bot, trigger):
bot.say(':| .¯. |: ._. :| .¯. |: ._. :| .¯. |: ._.')
@sopel.module.commands('ada', 'hoskinson')
def ada(bot, trigger):
bot.say('DO YOU KNOW WHO I AM?')