All pastes #490433 Raw Edit

Someone

public text v1 · immutable
·published 2007-05-16 00:38 UTC
rendered paste body

   UW PICO(tm) 4.10                                          File: quote.tcl                                             Modified   

# Quote Script by Steinsky.  Version: 1.2.1
# See www.cotch.net, irc.fwaggle.net, irc.zone.dk and virus.eleethal.com
#
# Adds channel commands: !addquote (And !quoteadd !+quote)
# and !quote with the option of an arg e.g. !quote *Steinsky*
# and !quotestats or !quotestats *matchtext*
# And the DCC Commands:
# .addquote <quote> and .quotestats or .quotestats *matchtext*
# And the MSG Commands:
# /msg botnick addquote <quote>  
#
# Needs more?  Talk to me on irc.fwaggle.net
# (Note: I edited some variables earlier and haven't tested to make sure I got them all, it should work though.)
  
# Where are the quotes ganna be kept?
set quotefile quote.txt
  
# Set this log file to store nick!user@host of people who added quotes
# I added this feature because a load of people added some crappy quotes and needed a slap
# I hardwired it in so you best make the file and set it, in the next version I'll add some more ifs
set quotelog quotewho.db
   
# 0 = display quotes in channel
# 1 = display quotes via private notice.
set quotevianotice 0
  
  
if { ![info exists toolbox_loaded] } { source scripts/alltools.tcl }
  
bind pub - .quote quote:pub:quote
bind pub - .addquote quote:pub:addquote
bind pub - .quoteadd quote:pub:addquote
bind pub - .+quote quote:pub:addquote
bind pub - .quotestats quote:pub:quotestats
bind dcc - addquote quote:dcc:addquote
bind msg - addquote quote:msg:addquote
bind dcc - quotestats quote:dcc:quotestats
 
proc quote:pub:quote {nick uhost hand chan arg} {
 global quotefile quotevianotice 
 set quotes ""
 if { [file exists $quotefile] } { set file [open $quotefile r]
 } else {
  if { $quotevianotice == 0 } { putmsg $chan "$quotefile does not exist. You'll need to add quotes to the database first by typing $
  if { $quotevianotice == 1 } { putnotc $nick "$quotefile does not exist. You'll need to add quotes to the database first by typing$
  return 0
 }
 while { ![eof $file] } {
  set quote [gets $file]
  if { $quote != "" } {
   set quotes [linsert $quotes end $quote]
  }
 }
 close $file
 if { $arg != "" } {
  set pattern [string tolower $arg]
  set aquotes ""
  set quote ""
  foreach quote $quotes {

^G Get Help           ^O WriteOut           ^R Read File          ^Y Prev Pg            ^K Cut Text           ^C Cur Pos            
^X Exit               ^J Justify            ^W Where is           ^V Next Pg            ^U UnCut Text         ^T To Spell