egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reporting on new data

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
kerum
Voice


Joined: 11 Jan 2013
Posts: 8

PostPosted: Sat Feb 09, 2013 2:57 am    Post subject: Reporting on new data Reply with quote

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
View user's profile Send private message
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Sat Feb 23, 2013 11:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
kerum
Voice


Joined: 11 Jan 2013
Posts: 8

PostPosted: Sun Feb 24, 2013 4:48 am    Post subject: Reply with quote

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
View user's profile Send private message
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Sun Feb 24, 2013 5:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
kerum
Voice


Joined: 11 Jan 2013
Posts: 8

PostPosted: Mon Feb 25, 2013 12:43 pm    Post subject: Reply with quote

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

Anyway, thanks a lot then.

If we ever meet, you gave a beer Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber