on $*:text:/[!]lastfm( |$)/iS:*:{ if ($2 = !lastfm) { return } if (!$2) { if ($($+(%,lastfm,.,$nick),2) != $null) { $np($($+(%,lastfm,.,$nick),2)) halt } else { msg $chan $nick - Syntax $1 [username] :: To set your username permanently type $replace($1,lastfm,setlastfm) [username] halt } } $np($strip($2)) } on $*:text:/[!]setlastfm( |$)/iS:*:{ set $+(%,lastfm,.,$nick) $iif($2,$2,$nick) msg $chan $nick your associated Last.FM profile is now $($+(%,lastfm,.,$nick),2) } alias -l lastfm { return $replace($1,>,>,<,<,&,&) } on *:sockread:lastfm*:{ tokenize 96 $sock($sockname).mark var %lf = $sockname if ($sockerr) { $2 $me is having difficulty reading the data from last.fm! halt } sockread &lastfm if ($regex([ [ $4 ] ],/(.*))) { $2 $+($regml(1),!) halt } elseif (nowplaying !isin [ [ $4 ] ]) { $2 $1 isn't playing music right now! sockclose %lf } else { $2 Last.fm : $+($chr(9833),$chr(9834),$chr(9835)) $+($chr(2),$& $lastfm($gettok($gettok([ [ $4 ] ],6,62),1,60)),$chr(2)) - $+($chr(2),$& $lastfm($gettok($gettok([ [ $4 ] ],8,62),1,60)),$chr(2)) $& $+($chr(9833),$chr(9835),$chr(9836)) sockclose %lf } } on *:sockopen:lastfm*:{ tokenize 96 $sock($sockname).mark if ($sockerr) { $2 $me is having difficulty connecting to lastfm's website! halt } $5 GET $+(/2.0/?method=user.getrecenttracks&user=,$1,&api_key=,$3) HTTP/1.1 $5 Host: $sock($sockname).addr $5 Connection: close $5 } alias np { if (!$1) { .notice $iif($isid,$nick,$me) Please enter a user name! e.g. /np halt } var %lastfm $+(lastfm,$r(1,9999),$ticks,$network,$cid) $+(sock,$iif($sock(%lastfm),close,open)) %lastfm ws.audioscrobbler.com 80 sockmark %lastfm $+($1,`,$iif($isid,.describe $iif(#,#,$nick),echo -at *),`,f6a3b7b12549aa211a6deec453c79417$& ,`,$!bvar(&lastfm,1-).text,`,sockwrite -nt %lastfm) }