Need some help with this script

Old posts that have not been replied to for several years.
Locked
User avatar
mrdr
Halfop
Posts: 42
Joined: Thu Jun 16, 2005 2:20 pm
Location: Lithuania / Vilnius / Underground
Contact:

Need some help with this script

Post by mrdr »

I have this script. Here's the example what it does.
me: !duxas nick
bot: {nick uzhduxintas}
And now I need, when I write "!unduxas nick" bot will delete that nick from the list. :)
Any ideas?

Code: Select all

# what would you like the commands (addquote and quote) prefixs to be?
set quoteitpubprefix "!"

# where would you like the quoteit data to be stored?
set quoteitfile "quoteit.data"

# would you like quotes to be displayed via private notice?
#
# 0 = no, display quotes in channel instead
# 1 = yes, display quotes via private notice.
set quoteitvianotice "1"

if { ![info exists toolbox_loaded] } { source scripts/alltools.tcl }

bind pub - [string trim $quoteitpubprefix]duxai quoteit:pub:quote
bind pub G|G [string trim $quoteitpubprefix]duxas quoteit:pub:addquote

proc quoteit:pub:quote {nick uhost hand chan arg} {
 global quoteitfile quoteitvianotice
 set quotes ""
 if { [file exists $quoteitfile] } { set file [open $quoteitfile r] 
 } else {
  if { $quoteitvianotice == 0 } { putmsg $chan "$quoteitfile does not exist. You'll need to add quotes to the database first by typing \002!addquote <a quote>\002" }
  if { $quoteitvianotice == 1 } { putnotc $nick "$quoteitfile does not exist. You'll need to add quotes to the database first by typing \002!addquote <a quote>\002" }
  return 0
 }
 while { ![eof $file] } {
  set quote [gets $file]
  if { $quote != "" } {
   set quotes [linsert $quotes end $quote]
  }
 }
 close $file
 set row [rand [llength $quotes]]
   set quote [list $quotes]
 
 if { $quote != "" } {
  if { $quoteitvianotice == 0 } {
   putmsg $chan "$quote"
  }
  if { $quoteitvianotice == 1 } {
   putnotc $nick "$quote"
  }
  return 1
 }
}

proc quoteit:pub:addquote {nick uhost hand chan arg} {
 global quoteitfile
 if { $arg == "" } {
  putnotc $nick "Usage: !duxas <nick>"
  return 0
 }
 set file [open $quoteitfile a]
 puts $file "$arg"
 close $file
 putmsg $chan "{$arg uzhduxintas}"
 return 1
}

putlog "*** Duxu tcl loaded"
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
Locked