User:Jabrwocky7/mirc searchbot

From Lostpedia

Jump to: navigation, search
on *:JOIN:#: { 
  /notice $nick Lostpedia Searchbot is active.  Usage: .lp search terms
  /halt  
}

on *:TEXT:.lp*:#lostpedia {
  if ( $2- = $null ) { 
    /msg $chan #ERROR# Lostpedia Searchbot Usage: .lp search terms 
    /halt
  }
;  /* Replace spaces with %20 */ 
  set %article $replace($$2-,$chr(32),$chr(37) $+ 20)
;  /* Replace + with ± */
  set %article $replace(%article,$chr(43),$chr(37) $+ C2%B1)
;  /* Use the URL for searches */
  set %lostpedia http://lostpedia.com/wiki/Special:Search?search=
  set %URL $+(%lostpedia,%article)
  /msg $chan %URL
  /halt
}