Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc qot_src {nick uhost hand chan rest} {
- global qot
- if {[qot_flood $nick $uhost]} {return 0}
- if {![catch {set fd [open $qot(file) r]}]} {
- set quote_num 1
- while {[gets $fd line] >= 0} {
- if {![catch {set ret [regexp -nocase -- $rest $line]}] && $ret} {
- lappend lines "[bold]([bold]Quote $quote_num[bold])[bold]: $line"
- }
- set quote_num [expr $quote_num + 1]
- }
- } else {
- putquick "PRIVMSG $chan :Unable to open $qot(file)"
- return
- }
- if {[llength $lines] > 0 } {
- set rand_quote [lindex $lines [rand [llength $lines]]]
- putquick "PRIVMSG $chan :$rand_quote"
- } else {
- putquick "PRIVMSG $chan :No quotes found matching: $rest"
- }
- putcmdlog "<<$nick>> !$hand! Searched in $chan for quotes matching: $rest"
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement