This kinda explains itself. Add it to your bot then you can type !currency [amount] [from] [to] and it will return the converted info
Example:
[20:14] @FamilyGuy › !currency 1 eur usd
[20:14] @stillborn › Currency: 1.00 EUR = 1.33061 USD
UPDATE:
on 1:TEXT:!currency *:#:{
if (%aflood. [ $+ [ $nick ] ]) { halt }
set -u5 %aflood. [ $+ [ $nick ] ] 1
if (!$4) { .notice $nick Syntax: $+($pre,currency) [amount] [from_value] [to_value] | return }
sockopen currency www.xe.com 80
sockmark currency $+(/ucc/convert.cgi?Amount=,$2,&From=,$upper($3),&To=,$upper($4),&image.x=59&image.y=7&image=Submit) # $2 $upper($3) $upper($4)
}
on 1:SOCKOPEN:currency:{
sockwrite -n $sockname GET $gettok($sock(currency).mark,1,32) HTTP/1.0
sockwrite -n $sockname Host: www.xe.com:80
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on 1:SOCKREAD:currency:{
var %sock.cur.source | sockread %sock.cur.source
if (*<title>* iswm %sock.cur.source) {
.msg $gettok($sock(currency).mark,2,32) Currency: $remove(%sock.cur.source,<title>,</title>,XE.com: $gettok($sock(currency).mark,4,32) to $gettok($sock(currency).mark,5,32) rate: )
sockclose currency
}
}
um just another way of making it using sockmark
i know it an be made better but w/e
on $*:text:/^@Currency/iS:#:{
if (!$hget(Currency,sets)) {
.hadd -mu4 Currency sets USD AUD CAD CHF CNY DKK EUR GBP HKD HUF INR JPY MXN MYR NOK NZD RUB SEK SGD THB ZAR
if ($2 isnum && $istok($hget(Currency,sets),$3,32) && $istok($hget(Currency,sets),$4,32) && !$5) {
if ($sock(Currency)) sockclose Currency
sockopen Currency www.xe.com 80
sockmark Currency $+(/ucc/convert.cgi?Amount=,$2,&From=,$3,&To=,$4) msg #
}
else { msg # $iif($2 !isnum || $5,Syntax: @currency amount from to EX: @currency 2 usd aud,please enter Currencys: $hget(Currency,sets)) }
}
}
on *:sockopen:Currency: {
sockwrite -nt $sockname GET $gettok($sock(Currency).mark,1,32) HTTP/1.1
sockwrite -nt $sockname Host: $+(www.xe.com,$str($crlf,2))
}
on *:sockread:Currency: {
var %Currency | sockread %Currency
if ($regex(%Currency,/<tr><td width=.+right.+>(.+)<.+WARNING:.+><\/h2><\/td>/)) { .hadd -mu4 Currency say $regml(1) }
if ($regex(%Currency,/<td width=.+left.+>(.+)<.+WARNING:.+><\/h2><\/td>/)) { $gettok($sock(Currency).mark,2-,32) $hget(Currency,say) = $regml(1) | sockclose Currency }
}