Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement