MashhitDK commented on a Page, English Slang Definition Checker  -  Jun 14, 2012

Simply add a @ to the on $:TEXT: event so it looks like this -> @$:TEXT:

on @$*:TEXT:/^[!@.]define( |$)/iS:*:{
  if (!$($+(%,-,$site,.,$cid,.,$nick),2)) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) { inc -u3 $+(%,-,$site,.,$cid,.,$nick) | var %ud = $+(ud,$str($ticks,3))
  $+(sock,$iif($sock(%ud),close,open) %ud api.urbandictionary.com 80) | sockmark %ud $replace($strip($2-),$chr(32),+) sockwrite -nt %ud .msg $iif(#,#,$nick) }
}

Above will only work if the user is OP'eD (@)
NOTE: Have "only" added the text event here... you'll need the rest of the script for it to work.

EDiT
I might have misunderstood you... the above will only work if the bot / host ( client running the script ) is OP'eD (@) and come to think of it that wasn't what you asked for I'm guessing ?

on *:sockopen:ud*:{ tokenize 32 $sock($sockname).mark 
  if ($sockerr) { $5-6 Socket Error! | halt }
  $2-4 GET $+(/v0/define?term=,$1) HTTP/1.0
  $2-4 Host: $+($sock($sockname).addr,$str($crlf,2)) 
  $2-4 Connection: close
}
on $*:TEXT:/^[!@.]define( |$)/iS:*:{
  if (!$($+(%,-,$site,.,$cid,.,$nick),2)) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) { inc -u3 $+(%,-,$site,.,$cid,.,$nick) | var %ud = $+(ud,$str($ticks,3))
  $+(sock,$iif($sock(%ud),close,open) %ud api.urbandictionary.com 80) | sockmark %ud $replace($strip($2-),$chr(32),+) sockwrite -nt %ud .msg $iif(#,#,$nick) }
}
on *:sockread:ud*:{ sockread &ud
  tokenize 32 $sock($sockname).mark
  if ($sockerr) { $5-6 Socket Error! }
  elseif (no_results isin $bvar(&ud,1-).text) { $5-6 $qt($1) is undefined! }
  elseif ($regex($bvar(&ud,1-).text,/"definition":"(.*)/)) { tokenize 34 $regml(1) | $gettok($sock($sockname).mark,5-6,32) $regsubex($1,/\Q\r\n\E/g,$chr(32)) }
  ;*** Use the one below and comment the one above out if you only want 1 line ( sockclose added to the one below )
  elseif ($regex($bvar(&ud,1-).text,/"definition":"(.*)/)) { tokenize 34 $regml(1) | $gettok($sock($sockname).mark,5-6,32) $regsubex($1,/\Q\r\n\E/g,$chr(32)) | sockclose $sockname }
}

The above will "only" work if the user is OP'eD (@) or above
And have added a extra line with sockclose in case people only want the first definition.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.