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.

Bitcoin pool BTCGuild api statistic in channel or notice

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
V
VoodooServ
Voice
Posts: 7
Joined: Sun Oct 27, 2013 12:49 pm
Location: Bulgaria / Pleven
Contact:

Bitcoin pool BTCGuild api statistic in channel or notice

Post by VoodooServ »

Hi people. I need eggdrop tcl for Bitcoin pool BTCGuild api statistic in channel or notice.
d
dutch1918
Voice
Posts: 14
Joined: Wed Jul 30, 2014 10:30 am

Post by dutch1918 »

Not sure what your looking for but assume this:

Code: Select all

proc bcp { min hour day month weekday } {
	set query "https://api.bitcoinaverage.com/ticker/global/USD/"
	::http::register https 443 [list ::tls::socket -require 0 -request 1]
	http::config -useragent {Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)}
	set token [http::geturl $query -timeout 6000]
	set rawData [http::data $token]
	http::cleanup $token
	regexp -nocase {"24h_avg":([^\,]*)} $rawData noop avg
	regexp -nocase {"ask":([^\,]*)} $rawData noop ask
	regexp -nocase {"bid":([^\,]*)} $rawData noop bid
	regexp -nocase {"last":([^\,]*)} $rawData noop last
	regexp -nocase {"timestamp":\s?"([^\"]*)} $rawData noop timestamp
	putserv "PRIVMSG $channel :\0030,12BITCOIN\017\00303 24hr Average\017 \002$avg\017 |\00312 Last \017\002$last\017 |\00303 Bid \017\002$bid\017 |\00304 Ask \017\002$ask\017 | $timestamp"
}

Post Reply