использование: !погода <город> [сегодня|завтра] - второй параметр не обязателен p.s. в аттаче скачайте базу с городами
on *:TEXT:*:#: {
if $1 == !weather || $1 == !погода || $1 == !п {
if !$2 { notice $nick $1 <город> [сегодня|завтра] }
elseif $read(weather.txt,w,* $+ $upper($left($2,1)) $+ $lower($right($2,$calc($len($2) - 1)))) { sockopen weather. [ $+ [ $chan ] $+ . $+ [ $nick ] ] weather.rambler.ru 80 | sockmark weather. [ $+ [ $chan ] $+ . $+ [ $nick ] ] $gettok($read(weather.txt,$readn),1,32) $chan $nick $iif($3,$3,сегодня) $upper($left($2,1)) $+ $lower($right($2,$calc($len($2) - 1))) }
else { notice $nick У меня нет в базе города $2 }
}
}
on *:SOCKOPEN:*: {
if weather. isin $sockname {
sockwrite -n $sockname GET /index.html?id= $+ $gettok($sock($sockname).mark,1,32) HTTP/1.0
sockwrite -n $sockname Host: weather.rambler.ru $+ $crlf $+ $crlf
}
}
on *:SOCKREAD:*: {
if weather. isin $sockname {
var % [ $+ [ $sockname ] $+ ] .tmp | sockread % [ $+ [ $sockname ] $+ ] .tmp | tokenize 32 % [ $+ [ $sockname ] $+ ] .tmp
if $gettok($sock($sockname).mark,4,32) == сегодня {
if Сегодня isin $1- { set % [ $+ [ $sockname ] $+ ] .read 1 }
if % [ $+ [ $sockname ] $+ ] .read {
if <td colspan="2" valign="top" style="padding:0 0 0 3px;" class="sdate" width="100%"> isin $1- { unset % [ $+ [ $sockname ] $+ ] .read | msg $gettok($sock($sockname).mark,2,32) $gettok($sock($sockname).mark,3,32) $+ , $gettok($sock($sockname).mark,5,32) % [ $+ [ $sockname ] $+ ] .info | unset % [ $+ [ $sockname ] $+ ] * }
set % [ $+ [ $sockname ] $+ ] .info % [ $+ [ $sockname ] $+ ] .info $striphtml($strip($1-))
}
}
else {
if <td colspan="2" valign="top" style="padding:0 0 0 3px;" class="sdate" width="100%"> isin $1- { set % [ $+ [ $sockname ] $+ ] .read 1 }
if % [ $+ [ $sockname ] $+ ] .read {
if </table> isin $1- { unset % [ $+ [ $sockname ] $+ ] .read | msg $gettok($sock($sockname).mark,2,32) $gettok($sock($sockname).mark,3,32) $+ , $gettok($sock($sockname).mark,5,32) % [ $+ [ $sockname ] $+ ] .info | unset % [ $+ [ $sockname ] $+ ] * }
set % [ $+ [ $sockname ] $+ ] .info % [ $+ [ $sockname ] $+ ] .info $striphtml($strip($1-))
}
}
}
}
on *:SOCKCLOSE:*: {
if weather. isin $sockname { unset % [ $+ [ $sockname ] $+ ] * }
}
alias -l striphtml {
if $1 {
var %strip, %parm = <> $remove($1-,> <,><,$chr(9)) <>, %n = 2
while $gettok($gettok(%parm,%n,62),1,60) { %strip = %strip $ifmatch | inc %n }
return $replace($remove(%strip, ),°,^,$chr(32) $+ $chr(32),$chr(32))
}
}