daily pastebin goal
80%
SHARE
TWEET

Untitled

a guest Jan 17th, 2018 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. proc qot_src {nick uhost hand chan rest} {
  2.     global qot
  3.  
  4.     if {[qot_flood $nick $uhost]} {return 0}
  5.  
  6.     if {![catch {set fd [open $qot(file) r]}]} {
  7.         set quote_num 1
  8.         while {[gets $fd line] >= 0} {
  9.             if {![catch {set ret [regexp -nocase -- $rest $line]}] && $ret} {
  10.                 lappend lines "[bold]([bold]Quote $quote_num[bold])[bold]: $line"
  11.             }
  12.             set quote_num [expr $quote_num + 1]
  13.         }
  14.     } else {
  15.         putquick "PRIVMSG $chan :Unable to open $qot(file)"
  16.         return
  17.     }
  18.  
  19.     if {[llength $lines] > 0 } {
  20.         set rand_quote [lindex $lines [rand [llength $lines]]]
  21.         putquick "PRIVMSG $chan :$rand_quote"
  22.     } else {
  23.         putquick "PRIVMSG $chan :No quotes found matching: $rest"
  24.     }
  25.  
  26.     putcmdlog "<<$nick>> !$hand! Searched in $chan for quotes matching: $rest"
  27.     return
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top