This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Reporting on new data

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
k
kerum
Voice
Posts: 8
Joined: Fri Jan 11, 2013 10:06 am

Reporting on new data

Post by kerum »

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.
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

this is pretty old, but there wasn't anything else to do here and I wanted to do something...

Code: Select all

###
# 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
}
k
kerum
Voice
Posts: 8
Joined: Fri Jan 11, 2013 10:06 am

Post by kerum »

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.
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

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.
k
kerum
Voice
Posts: 8
Joined: Fri Jan 11, 2013 10:06 am

Post by kerum »

Yeah, I thought, does it only report blocks from there.

Anyway, thanks a lot then.

If we ever meet, you gave a beer :D
Post Reply