| View previous topic :: View next topic |
| Author |
Message |
kerum Voice
Joined: 11 Jan 2013 Posts: 8
|
Posted: Sat Feb 09, 2013 2:57 am Post subject: Reporting on new data |
|
|
Hi. I would need eggdrop to go on this website: http://eligius.st/~wizkid057/newstats/
And report if a new block is found. It should go every five minutes.
And if a new block is found, it should say that in the IRC channel, if not, keep quiet.
Thank you very much. |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Sat Feb 23, 2013 11:18 pm Post subject: |
|
|
this is pretty old, but there wasn't anything else to do here and I wanted to do something...
| Code: | ###
# Settings
set blocks_url "http://eligius.st/~wizkid057/newstats/"
set blocks_channel "#ilikeblocks"
set blocks_interval 5
# end of settings
##
package require http;
proc getBlocks {} {
set http [http::geturl $::blocks_url]
set data [http::data $http]
http::cleanup $http
return [lindex [regexp -inline -nocase {.*<a href=\"http://blockchain\.info/block/(.*?)\">.*} $data] 1]
}
if {![info exists blocks_running]} {
set blocks_current [getBlocks]
timer 5 blockTimer
set blocks_running 1
}
proc blockTimer {} {
set newblock [getBlocks]
if {$newblock != $::blocks_current} {
set ::blocks_current $newblock
putserv "PRIVMSG $::blocks_channel :New Block found! Hash: $newblock"
}
timer 5 blockTimer
} |
|
|
| Back to top |
|
 |
kerum Voice
Joined: 11 Jan 2013 Posts: 8
|
Posted: Sun Feb 24, 2013 4:48 am Post subject: |
|
|
Cool. Will try it out.
Will it only report blocks from Eligius-Ra?
And one more thing, will you make it announce in a specific channel, not PRIVMSG.
P.S. If you have a Bitcoin address, give it to me, I'll pay you a beer. |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Sun Feb 24, 2013 5:38 pm Post subject: |
|
|
I'm not sure what you mean with your first question, it will report blocks from the "recent blocks" table at the link you gave.
It will probably work on any other page with the exact same layout, if there are any, I mainly added the link into the configuration for the case that the address changes someday.
It will by the way report into a channel, the command PRIVMSG is used both for channel messages and user messages in IRC. You can set the channel at the top of the script.
Also any Bitcoins would be wasted on me, I have a wallet somewhere but I never used it. |
|
| Back to top |
|
 |
kerum Voice
Joined: 11 Jan 2013 Posts: 8
|
Posted: Mon Feb 25, 2013 12:43 pm Post subject: |
|
|
Yeah, I thought, does it only report blocks from there.
Anyway, thanks a lot then.
If we ever meet, you gave a beer  |
|
| Back to top |
|
 |
|