# ByRequest.tcl Version 1.0 (6 Feb 2013) #
# author: SpiKe^^ #
# e-mail: spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #
# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html #
########### General Text File Settings ###########
# Set the full route & file name of the file to edit #
# Note: The !req <message> command will attempt to make this file if needed.
set byReq(file) {/usr/home/spike/eggdrop/scripts/byreq.txt}
########### Public 'Add Request' Command Settings ###########
## settings for the public !req <message> command ##
# Set the listen channel(s) for !req <message> command #
set byReq(achan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the !req <message> command #
set byReq(aflags) {R|R}
# Set the public trigger for the !req <message> command #
# to add a request at the end of the file:
# example: !req I want coke.
set byReq(add) {!req}
########### Public 'Read Requests' Commands Settings ###########
## settings for the public !reqview <req#> and !reqlist commands ##
# Set the listen channel(s) for the public Read Requests commands #
set byReq(rchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Read Requests commands #
set byReq(rflags) {o|o}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(rhow) "1"
# Set the public trigger for the !reqview <req#> / !reqview <handle> command #
# to read a specific request (by line number) from the text file
# example: !reqview 4
# note: use to check for correct line before doing !reqedit or !reqdone
# to read all requests by <handle> from the text file
# example: !reqview spike
set byReq(read) {!reqview}
# Set the public trigger for the !reqlist command #
# to read all requests from the text file
# example: !reqlist
set byReq(readf) {!reqlist}
########### Public 'Edit/Delete Requests' Commands Settings ###########
## settings for the public !reqedit <req#> and !reqdone <req#> commands ##
# Set the listen channel(s) for the public Edit/Delete Requests commands #
set byReq(echan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Edit/Delete Requests commands #
set byReq(eflags) {m|m}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(ehow) "1"
# Set the public trigger for the !reqedit <req#> <new text> command #
# to edit a specific request (by line number) in the text file
# example: !reqedit 4 coke is not good for health.
set byReq(edit) {!reqedit}
# Set the public trigger for the !reqdone <req#> command #
# to delete a specific request (by line number) from the text file
# example: !reqdone 4
# note: this will renumber all requests after request 4!
set byReq(del) {!reqdone}
########### Public 'Delete All Requests' Command Settings ###########
## settings for the public !reqpurge command ##
# Set the listen channel(s) for the public Delete All Requests command #
set byReq(dchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Delete All Requests command #
set byReq(dflags) {n|n}
# Should this command reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(dhow) "1"
# Set the public trigger for the !reqpurge command #
# to delete all requests from the text file
# example: !reqpurge
set byReq(delf) {!reqpurge}
########### Public 'Read User Comment' Command Settings ###########
## settings for the public !requser command ##
# Set the listen channel(s) for the public Read User Comment command #
set byReq(uchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Read User Comment command #
set byReq(uflags) {n|n}
# Should this command reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(uhow) "2"
# Set the public trigger for the !reqpurge command #
# to delete all requests from the text file
# example: !reqpurge
set byReq(user) {!requser}
################ End Settings ################
bind pub $byReq(aflags) $byReq(add) bReqProcAdd
bind pub $byReq(rflags) $byReq(read) bReqProcRead
bind pub $byReq(rflags) $byReq(readf) bReqProcReadF
bind pub $byReq(eflags) $byReq(del) bReqProcDel
bind pub $byReq(eflags) $byReq(edit) bReqProcEdit
bind pub $byReq(dflags) $byReq(delf) bReqProcDelF
bind pub $byReq(uflags) $byReq(user) bReqProcUser
set byReq(achan) [split [string tolower $byReq(achan)]]
set byReq(rchan) [split [string tolower $byReq(rchan)]]
set byReq(echan) [split [string tolower $byReq(echan)]]
set byReq(dchan) [split [string tolower $byReq(dchan)]]
set byReq(uchan) [split [string tolower $byReq(uchan)]]
if {$byReq(rhow) ne "2"} { set byReq(rhow) 1 }
if {$byReq(ehow) ne "2"} { set byReq(ehow) 1 }
if {$byReq(dhow) ne "2"} { set byReq(dhow) 1 }
if {$byReq(uhow) ne "2"} { set byReq(uhow) 1 }
proc bReqProcAdd {nk uh hn ch tx} {
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $::byReq(achan) $ch]=="-1"} { return 0 }
if {$tx eq ""} {
puthelp "PRIVMSG $ch :Correct syntax is: $::byReq(add) <your-message-here>"
puthelp "PRIVMSG $ch :Example: $::byReq(add) I want coke." ; return 0
}
set tf $::byReq(file) ; set ftime [clock format [unixtime] -format %D@%R]
set id [open $tf a] ; puts $id "\[$hn\] $tx ($ftime)" ; close $id
if {![file exists $tf]} {
puthelp "PRIVMSG $ch :Unable to find or make text file: $tf"
} else { puthelp "PRIVMSG $ch :$nk: Request Accepted." }
return 0
}
proc bReqProcReadF {nk uh hn ch tx} {
bReqProcRead $nk $uh $hn $ch $tx file ; return 0
}
proc bReqProcRead {nk uh hn ch tx {do line} } {
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $::byReq(rchan) $ch]=="-1"} { return 0 }
if {$byReq(rhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$do eq "line" && $tx eq ""} {
puthelp "$pre :Correct syntax is: $::byReq(read) <line# or handle>"
puthelp "$pre :Example: $::byReq(read) 4"
puthelp "$pre :Example: $::byReq(read) spike"
puthelp "$pre :Or type $::byReq(readf) to see all pending requests." ; return 0
}
set tf $::byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
if {$do eq "line"} { set tx [lindex [split $tx] 0] ; set scnt 0
if {[string is digit -strict $tx]} { set fline $tx } else { set fhand "\\\[$tx\\\] *" }
}
set tid [open $tf] ; set lnum 0
while {![eof $tid]} { set line [gets $tid]
if {$line ne ""} { incr lnum
if {$do eq "file"} { puthelp "$pre :$lnum - $line"
} elseif {[info exists fline] && $lnum==$fline} {
puthelp "$pre :$lnum - $line" ; break
} elseif {[info exists fhand] && [string match -nocase $fhand $line]} {
puthelp "$pre :$lnum - $line" ; incr scnt
}
}
}
close $tid
if {$lnum=="0"} { puthelp "$pre :$nk: There are no pending requests." ; return 0 }
if {$do eq "file"} { puthelp "$pre :List Completed – Total Pending Requests ($lnum)."
} elseif {[info exists fhand] && $scnt=="0"} { puthelp "$pre :$tx has no pending requests."
} elseif {[info exists fline] && $fline>$lnum} { set tl request
if {$lnum>"1"} { set tl requests }
puthelp "$pre :$nk: Request number $fline doesn't exist ($lnum pending $tl)."
}
return 0
}
proc bReqProcDel {nk uh hn ch tx} {
bReqProcEdit $nk $uh $hn $ch $tx del ; return 0
}
proc bReqProcEdit {nk uh hn ch tx {do edit} } {
set ch [string tolower $ch] ; set tx [split [string trim $tx]]
if {[lsearch -exact $::byReq(echan) $ch]=="-1"} { return 0 }
if {$byReq(ehow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$do eq "edit"} {
if {[llength $tx]<"2" || ![string is digit -strict [lindex $tx 0]]} {
puthelp "$pre :Correct syntax is: $::byReq(edit) <req#> <new-message>"
puthelp "$pre :Example: $::byReq(edit) 4 coke is not good for health." ; return 0
}
} elseif {$do eq "del" && ![string is digit -strict [lindex $tx 0]]} {
puthelp "$pre :Correct syntax is: $::byReq(del) <req#>"
puthelp "$pre :Example: $::byReq(del) 4" ; return 0
}
set tf $::byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
set find [lindex $tx 0] ; set tx [string trim [join [lrange $tx 1 end]]]
set new [file dirname $tf]/newfile.tmp ; set nid [open $new w]
set tid [open $tf] ; set lnum 0
while {![eof $tid]} { set line [gets $tid]
if {$line ne ""} { incr lnum
if {$lnum==$find} {
if {$do eq "edit"} { set line [split $line]
set date [lindex $line end] ; set hand [lindex $line 0]
puthelp "$pre :$nk: Requests List Updated successfully."
puts $nid "$hand $tx $date"
} elseif {$do eq "del"} {
puthelp "$pre :$nk: Request Done – Deleted from the list."
}
} else { puts $nid $line }
}
}
close $tid
if {$find>$lnum} {
if {$lnum>"0"} { set tl request
if {$lnum>"1"} { set tl requests }
puthelp "$pre :$nk: Request number $find doesn't exist ($lnum pending $tl)."
} else { puthelp "$pre :$nk: There are no pending requests." }
close $nid ; file delete $new
} else { close $nid ; file rename -force $new $tf }
return 0
}
proc bReqProcDelF {nk uh hn ch tx} {
set ch [string tolower $ch]
if {[lsearch -exact $::byReq(dchan) $ch]=="-1"} { return 0 }
if {$byReq(dhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
set tf $::byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
puthelp "$pre :$nk: All pending requests deleted successfully!"
file delete $tf ; return 0
}
proc bReqProcUser {nk uh hn ch tx} {
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $::byReq(uchan) $ch]=="-1"} { return 0 }
if {$byReq(uhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$tx eq ""} {
puthelp "$pre :Correct syntax is: $::byReq(user) <handle>"
puthelp "$pre :Example: $::byReq(user) spike" ; return 0
}
set tx [lindex [split $tx] 0]
if {![validuser $tx]} {
puthelp "$pre :$nk: $tx is not a valid user handle." ; return 0
}
if {[set cmt [getuser $tx COMMENT]] eq ""} {
puthelp "$pre :$nk: There is no comment for $tx." ; return 0
}
puthelp "$pre :$nk: $tx - $cmt" ; return 0
}
putlog "ByRequest.tcl Ver. 1.0 by SpiKe^^ loaded."
# ByRequest.tcl Version 1.0 (6 Feb 2013) #
# author: SpiKe^^ #
# e-mail: spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #
# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html #
########### General Text File Settings ###########
# Set the full route & file name of the file to edit #
# Note: The !req <message> command will attempt to make this file if needed.
set byReq(file) {/usr/home/spike/eggdrop/scripts/byreq.txt}
########### Public 'Add Request' Command Settings ###########
## settings for the public !req <message> command ##
# Set the listen channel(s) for !req <message> command #
set byReq(achan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the !req <message> command #
set byReq(aflags) {R|R}
# Set the public trigger for the !req <message> command #
# to add a request at the end of the file:
# example: !req I want coke.
set byReq(add) {!req}
########### Public 'Read Requests' Commands Settings ###########
## settings for the public !reqview <req#> and !reqlist commands ##
# Set the listen channel(s) for the public Read Requests commands #
set byReq(rchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Read Requests commands #
set byReq(rflags) {o|o}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(rhow) "1"
# Set the public trigger for the !reqview <req#> / !reqview <handle> command #
# to read a specific request (by line number) from the text file
# example: !reqview 4
# note: use to check for correct line before doing !reqedit or !reqdone
# to read all requests by <handle> from the text file
# example: !reqview spike
set byReq(read) {!reqview}
# Set the public trigger for the !reqlist command #
# to read all requests from the text file
# example: !reqlist
set byReq(readf) {!reqlist}
########### Public 'Edit/Delete Requests' Commands Settings ###########
## settings for the public !reqedit <req#> and !reqdone <req#> commands ##
# Set the listen channel(s) for the public Edit/Delete Requests commands #
set byReq(echan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Edit/Delete Requests commands #
set byReq(eflags) {m|m}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(ehow) "1"
# Set the public trigger for the !reqedit <req#> <new text> command #
# to edit a specific request (by line number) in the text file
# example: !reqedit 4 coke is not good for health.
set byReq(edit) {!reqedit}
# Set the public trigger for the !reqdone <req#> command #
# to delete a specific request (by line number) from the text file
# example: !reqdone 4
# note: this will renumber all requests after request 4!
set byReq(del) {!reqdone}
########### Public 'Delete All Requests' Command Settings ###########
## settings for the public !reqpurge command ##
# Set the listen channel(s) for the public Delete All Requests command #
set byReq(dchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Delete All Requests command #
set byReq(dflags) {n|n}
# Should this command reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(dhow) "1"
# Set the public trigger for the !reqpurge command #
# to delete all requests from the text file
# example: !reqpurge
set byReq(delf) {!reqpurge}
########### Public 'Read User Comment' Command Settings ###########
## settings for the public !requser command ##
# Set the listen channel(s) for the public Read User Comment command #
set byReq(uchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Read User Comment command #
set byReq(uflags) {n|n}
# Should this command reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(uhow) "2"
# Set the public trigger for the !reqpurge command #
# to delete all requests from the text file
# example: !reqpurge
set byReq(user) {!requser}
################ End Settings ################
bind pub $byReq(aflags) $byReq(add) bReqProcAdd
bind pub $byReq(rflags) $byReq(read) bReqProcRead
bind pub $byReq(rflags) $byReq(readf) bReqProcReadF
bind pub $byReq(eflags) $byReq(del) bReqProcDel
bind pub $byReq(eflags) $byReq(edit) bReqProcEdit
bind pub $byReq(dflags) $byReq(delf) bReqProcDelF
bind pub $byReq(uflags) $byReq(user) bReqProcUser
set byReq(achan) [split [string tolower $byReq(achan)]]
set byReq(rchan) [split [string tolower $byReq(rchan)]]
set byReq(echan) [split [string tolower $byReq(echan)]]
set byReq(dchan) [split [string tolower $byReq(dchan)]]
set byReq(uchan) [split [string tolower $byReq(uchan)]]
if {$byReq(rhow) ne "2"} { set byReq(rhow) 1 }
if {$byReq(ehow) ne "2"} { set byReq(ehow) 1 }
if {$byReq(dhow) ne "2"} { set byReq(dhow) 1 }
if {$byReq(uhow) ne "2"} { set byReq(uhow) 1 }
proc bReqProcAdd {nk uh hn ch tx} {
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $::byReq(achan) $ch]=="-1"} { return 0 }
if {$tx eq ""} {
puthelp "PRIVMSG $ch :Correct syntax is: $::byReq(add) <your-message-here>"
puthelp "PRIVMSG $ch :Example: $::byReq(add) I want coke." ; return 0
}
set tf $::byReq(file) ; set ftime [clock format [unixtime] -format %D@%R]
set id [open $tf a] ; puts $id "\[$hn\] $tx ($ftime)" ; close $id
if {![file exists $tf]} {
puthelp "PRIVMSG $ch :Unable to find or make text file: $tf"
} else { puthelp "PRIVMSG $ch :$nk: Request Accepted." }
return 0
}
proc bReqProcReadF {nk uh hn ch tx} {
bReqProcRead $nk $uh $hn $ch $tx file ; return 0
}
proc bReqProcRead {nk uh hn ch tx {do line} } {
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $::byReq(rchan) $ch]=="-1"} { return 0 }
if {$::byReq(rhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$do eq "line" && $tx eq ""} {
puthelp "$pre :Correct syntax is: $::byReq(read) <line# or handle>"
puthelp "$pre :Example: $::byReq(read) 4"
puthelp "$pre :Example: $::byReq(read) spike"
puthelp "$pre :Or type $::byReq(readf) to see all pending requests." ; return 0
}
set tf $::byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
if {$do eq "line"} { set tx [lindex [split $tx] 0] ; set scnt 0
if {[string is digit -strict $tx]} { set fline $tx } else { set fhand "\\\[$tx\\\] *" }
}
set tid [open $tf] ; set lnum 0
while {![eof $tid]} { set line [gets $tid]
if {$line ne ""} { incr lnum
if {$do eq "file"} { puthelp "$pre :$lnum - $line"
} elseif {[info exists fline] && $lnum==$fline} {
puthelp "$pre :$lnum - $line" ; break
} elseif {[info exists fhand] && [string match -nocase $fhand $line]} {
puthelp "$pre :$lnum - $line" ; incr scnt
}
}
}
close $tid
if {$lnum=="0"} { puthelp "$pre :$nk: There are no pending requests." ; return 0 }
if {$do eq "file"} { puthelp "$pre :List Completed – Total Pending Requests ($lnum)."
} elseif {[info exists fhand] && $scnt=="0"} { puthelp "$pre :$tx has no pending requests."
} elseif {[info exists fline] && $fline>$lnum} { set tl request
if {$lnum>"1"} { set tl requests }
puthelp "$pre :$nk: Request number $fline doesn't exist ($lnum pending $tl)."
}
return 0
}
proc bReqProcDel {nk uh hn ch tx} {
bReqProcEdit $nk $uh $hn $ch $tx del ; return 0
}
proc bReqProcEdit {nk uh hn ch tx {do edit} } {
set ch [string tolower $ch] ; set tx [split [string trim $tx]]
if {[lsearch -exact $::byReq(echan) $ch]=="-1"} { return 0 }
if {$::byReq(ehow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$do eq "edit"} {
if {[llength $tx]<"2" || ![string is digit -strict [lindex $tx 0]]} {
puthelp "$pre :Correct syntax is: $::byReq(edit) <req#> <new-message>"
puthelp "$pre :Example: $::byReq(edit) 4 coke is not good for health." ; return 0
}
} elseif {$do eq "del" && ![string is digit -strict [lindex $tx 0]]} {
puthelp "$pre :Correct syntax is: $::byReq(del) <req#>"
puthelp "$pre :Example: $::byReq(del) 4" ; return 0
}
set tf $::byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
set find [lindex $tx 0] ; set tx [string trim [join [lrange $tx 1 end]]]
set new [file dirname $tf]/newfile.tmp ; set nid [open $new w]
set tid [open $tf] ; set lnum 0
while {![eof $tid]} { set line [gets $tid]
if {$line ne ""} { incr lnum
if {$lnum==$find} {
if {$do eq "edit"} { set line [split $line]
set date [lindex $line end] ; set hand [lindex $line 0]
puthelp "$pre :$nk: Requests List Updated successfully."
puts $nid "$hand $tx $date"
} elseif {$do eq "del"} {
puthelp "$pre :$nk: Request Done – Deleted from the list."
}
} else { puts $nid $line }
}
}
close $tid
if {$find>$lnum} {
if {$lnum>"0"} { set tl request
if {$lnum>"1"} { set tl requests }
puthelp "$pre :$nk: Request number $find doesn't exist ($lnum pending $tl)."
} else { puthelp "$pre :$nk: There are no pending requests." }
close $nid ; file delete $new
} else { close $nid ; file rename -force $new $tf }
return 0
}
proc bReqProcDelF {nk uh hn ch tx} {
set ch [string tolower $ch]
if {[lsearch -exact $::byReq(dchan) $ch]=="-1"} { return 0 }
if {$::byReq(dhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
set tf $::byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
puthelp "$pre :$nk: All pending requests deleted successfully!"
file delete $tf ; return 0
}
proc bReqProcUser {nk uh hn ch tx} {
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $::byReq(uchan) $ch]=="-1"} { return 0 }
if {$::byReq(uhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$tx eq ""} {
puthelp "$pre :Correct syntax is: $::byReq(user) <handle>"
puthelp "$pre :Example: $::byReq(user) spike" ; return 0
}
set tx [lindex [split $tx] 0]
if {![validuser $tx]} {
puthelp "$pre :$nk: $tx is not a valid user handle." ; return 0
}
if {[set cmt [getuser $tx COMMENT]] eq ""} {
puthelp "$pre :$nk: There is no comment for $tx." ; return 0
}
puthelp "$pre :$nk: $tx - $cmt" ; return 0
}
putlog "ByRequest.tcl Ver. 1.0 by SpiKe^^ loaded."
<(Bot> [05:49] Tcl error [bReqProcRead]: can't read "byReq(rhow)": no such variable
<(Bot> [05:49] Tcl error [bReqProcEdit]: can't read "byReq(ehow)": no such variable
<(Bot> [05:49] Tcl error [bReqProcUser]: can't read "byReq(uhow)": no such variable
<(Bot> [05:50] Tcl error [bReqProcReadF]: can't read "byReq(rhow)": no such variable
Q) When to use the "global var" statement versus referencing the variable directly in global space using $::var ?
A) When you reference it more than twice using $:: a global would've been the better choice. Yes! Because the more you reference your var with $::, you may forget once and simply use $. It's a headache and a chore to keep in check. As well as, it's slower to copy vars from the same array 3x, than to have just copied the entire array at once.
Anyways, here is a correction and yes, this version chose to global. Enjoy. All credit to Spike^^. Long live eggdrop. Dance like an robot. Beep boop beep...
# ByRequest.tcl Version 1.0 (6 Feb 2013) #
# author: SpiKe^^ #
# e-mail: spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #
# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html #
########### General Text File Settings ###########
# Set the full route & file name of the file to edit #
# Note: The !req <message> command will attempt to make this file if needed.
set byReq(file) {/usr/home/spike/eggdrop/scripts/byreq.txt}
########### Public 'Add Request' Command Settings ###########
## settings for the public !req <message> command ##
# Set the listen channel(s) for !req <message> command #
set byReq(achan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the !req <message> command #
set byReq(aflags) {R|R}
# Set the public trigger for the !req <message> command #
# to add a request at the end of the file:
# example: !req I want coke.
set byReq(add) {!req}
########### Public 'Read Requests' Commands Settings ###########
## settings for the public !reqview <req#> and !reqlist commands ##
# Set the listen channel(s) for the public Read Requests commands #
set byReq(rchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Read Requests commands #
set byReq(rflags) {o|o}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(rhow) "1"
# Set the public trigger for the !reqview <req#> / !reqview <handle> command #
# to read a specific request (by line number) from the text file
# example: !reqview 4
# note: use to check for correct line before doing !reqedit or !reqdone
# to read all requests by <handle> from the text file
# example: !reqview spike
set byReq(read) {!reqview}
# Set the public trigger for the !reqlist command #
# to read all requests from the text file
# example: !reqlist
set byReq(readf) {!reqlist}
########### Public 'Edit/Delete Requests' Commands Settings ###########
## settings for the public !reqedit <req#> and !reqdone <req#> commands ##
# Set the listen channel(s) for the public Edit/Delete Requests commands #
set byReq(echan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Edit/Delete Requests commands #
set byReq(eflags) {m|m}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(ehow) "1"
# Set the public trigger for the !reqedit <req#> <new text> command #
# to edit a specific request (by line number) in the text file
# example: !reqedit 4 coke is not good for health.
set byReq(edit) {!reqedit}
# Set the public trigger for the !reqdone <req#> command #
# to delete a specific request (by line number) from the text file
# example: !reqdone 4
# note: this will renumber all requests after request 4!
set byReq(del) {!reqdone}
########### Public 'Delete All Requests' Command Settings ###########
## settings for the public !reqpurge command ##
# Set the listen channel(s) for the public Delete All Requests command #
set byReq(dchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Delete All Requests command #
set byReq(dflags) {n|n}
# Should this command reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(dhow) "1"
# Set the public trigger for the !reqpurge command #
# to delete all requests from the text file
# example: !reqpurge
set byReq(delf) {!reqpurge}
########### Public 'Read User Comment' Command Settings ###########
## settings for the public !requser command ##
# Set the listen channel(s) for the public Read User Comment command #
set byReq(uchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Read User Comment command #
set byReq(uflags) {n|n}
# Should this command reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(uhow) "2"
# Set the public trigger for the !reqpurge command #
# to delete all requests from the text file
# example: !reqpurge
set byReq(user) {!requser}
################ End Settings ################
bind pub $byReq(aflags) $byReq(add) bReqProcAdd
bind pub $byReq(rflags) $byReq(read) bReqProcRead
bind pub $byReq(rflags) $byReq(readf) bReqProcReadF
bind pub $byReq(eflags) $byReq(del) bReqProcDel
bind pub $byReq(eflags) $byReq(edit) bReqProcEdit
bind pub $byReq(dflags) $byReq(delf) bReqProcDelF
bind pub $byReq(uflags) $byReq(user) bReqProcUser
set byReq(achan) [split [string tolower $byReq(achan)]]
set byReq(rchan) [split [string tolower $byReq(rchan)]]
set byReq(echan) [split [string tolower $byReq(echan)]]
set byReq(dchan) [split [string tolower $byReq(dchan)]]
set byReq(uchan) [split [string tolower $byReq(uchan)]]
if {$byReq(rhow) ne "2"} { set byReq(rhow) 1 }
if {$byReq(ehow) ne "2"} { set byReq(ehow) 1 }
if {$byReq(dhow) ne "2"} { set byReq(dhow) 1 }
if {$byReq(uhow) ne "2"} { set byReq(uhow) 1 }
proc bReqProcAdd {nk uh hn ch tx} {
global byReq
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $byReq(achan) $ch]=="-1"} { return 0 }
if {$tx eq ""} {
puthelp "PRIVMSG $ch :Correct syntax is: $byReq(add) <your-message-here>"
puthelp "PRIVMSG $ch :Example: $byReq(add) I want coke." ; return 0
}
set tf $byReq(file) ; set ftime [clock format [unixtime] -format %D@%R]
set id [open $tf a] ; puts $id "\[$hn\] $tx ($ftime)" ; close $id
if {![file exists $tf]} {
puthelp "PRIVMSG $ch :Unable to find or make text file: $tf"
} else { puthelp "PRIVMSG $ch :$nk: Request Accepted." }
return 0
}
proc bReqProcReadF {nk uh hn ch tx} {
bReqProcRead $nk $uh $hn $ch $tx file ; return 0
}
proc bReqProcRead {nk uh hn ch tx {do line} } {
global byReq
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $byReq(rchan) $ch]=="-1"} { return 0 }
if {$byReq(rhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$do eq "line" && $tx eq ""} {
puthelp "$pre :Correct syntax is: $byReq(read) <line# or handle>"
puthelp "$pre :Example: $byReq(read) 4"
puthelp "$pre :Example: $byReq(read) spike"
puthelp "$pre :Or type $byReq(readf) to see all pending requests." ; return 0
}
set tf $byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
if {$do eq "line"} { set tx [lindex [split $tx] 0] ; set scnt 0
if {[string is digit -strict $tx]} { set fline $tx } else { set fhand "\\\[$tx\\\] *" }
}
set tid [open $tf] ; set lnum 0
while {![eof $tid]} { set line [gets $tid]
if {$line ne ""} { incr lnum
if {$do eq "file"} { puthelp "$pre :$lnum - $line"
} elseif {[info exists fline] && $lnum==$fline} {
puthelp "$pre :$lnum - $line" ; break
} elseif {[info exists fhand] && [string match -nocase $fhand $line]} {
puthelp "$pre :$lnum - $line" ; incr scnt
}
}
}
close $tid
if {$lnum=="0"} { puthelp "$pre :$nk: There are no pending requests." ; return 0 }
if {$do eq "file"} { puthelp "$pre :List Completed - Total Pending Requests ($lnum)."
} elseif {[info exists fhand] && $scnt=="0"} { puthelp "$pre :$tx has no pending requests."
} elseif {[info exists fline] && $fline>$lnum} { set tl request
if {$lnum>"1"} { set tl requests }
puthelp "$pre :$nk: Request number $fline doesn't exist ($lnum pending $tl)."
}
return 0
}
proc bReqProcDel {nk uh hn ch tx} {
bReqProcEdit $nk $uh $hn $ch $tx del ; return 0
}
proc bReqProcEdit {nk uh hn ch tx {do edit} } {
global byReq
set ch [string tolower $ch] ; set tx [split [string trim $tx]]
if {[lsearch -exact $byReq(echan) $ch]=="-1"} { return 0 }
if {$byReq(ehow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$do eq "edit"} {
if {[llength $tx]<"2" || ![string is digit -strict [lindex $tx 0]]} {
puthelp "$pre :Correct syntax is: $byReq(edit) <req#> <new-message>"
puthelp "$pre :Example: $byReq(edit) 4 coke is not good for health." ; return 0
}
} elseif {$do eq "del" && ![string is digit -strict [lindex $tx 0]]} {
puthelp "$pre :Correct syntax is: $byReq(del) <req#>"
puthelp "$pre :Example: $byReq(del) 4" ; return 0
}
set tf $byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
set find [lindex $tx 0] ; set tx [string trim [join [lrange $tx 1 end]]]
set new [file dirname $tf]/newfile.tmp ; set nid [open $new w]
set tid [open $tf] ; set lnum 0
while {![eof $tid]} { set line [gets $tid]
if {$line ne ""} { incr lnum
if {$lnum==$find} {
if {$do eq "edit"} { set line [split $line]
set date [lindex $line end] ; set hand [lindex $line 0]
puthelp "$pre :$nk: Requests List Updated successfully."
puts $nid "$hand $tx $date"
} elseif {$do eq "del"} {
puthelp "$pre :$nk: Request Done - Deleted from the list."
}
} else { puts $nid $line }
}
}
close $tid
if {$find>$lnum} {
if {$lnum>"0"} { set tl request
if {$lnum>"1"} { set tl requests }
puthelp "$pre :$nk: Request number $find doesn't exist ($lnum pending $tl)."
} else { puthelp "$pre :$nk: There are no pending requests." }
close $nid ; file delete $new
} else { close $nid ; file rename -force $new $tf }
return 0
}
proc bReqProcDelF {nk uh hn ch tx} {
global byReq
set ch [string tolower $ch]
if {[lsearch -exact $byReq(dchan) $ch]=="-1"} { return 0 }
if {$byReq(dhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
set tf $byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
puthelp "$pre :$nk: All pending requests deleted successfully!"
file delete $tf ; return 0
}
proc bReqProcUser {nk uh hn ch tx} {
global byReq
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $byReq(uchan) $ch]=="-1"} { return 0 }
if {$byReq(uhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$tx eq ""} {
puthelp "$pre :Correct syntax is: $byReq(user) <handle>"
puthelp "$pre :Example: $byReq(user) spike" ; return 0
}
set tx [lindex [split $tx] 0]
if {![validuser $tx]} {
puthelp "$pre :$nk: $tx is not a valid user handle." ; return 0
}
if {[set cmt [getuser $tx COMMENT]] eq ""} {
puthelp "$pre :$nk: There is no comment for $tx." ; return 0
}
puthelp "$pre :$nk: $tx - $cmt" ; return 0
}
putlog "ByRequest.tcl Ver. 1.0 by SpiKe^^ loaded."
Thanks to all for helping me, and sorry for my late reply as I am traveling now a days still not at home but I've checked this one and it works awesome...
I facing some strange problem which I observed couple of days ago.
Using this script bot does not respond to pub commands unless I do partyline access.
Second thing How it respond to pub command without partyline?
I've added 2 channels #abc & #xyz on the bot, but when I tried to use !req on #abc so it doesnt respond and after that when I tried to use !req in #xyz it respond to it and eventually it start responding on channel #abc again, why?
When both the channels are added and it its responding to 1 channel, why not responding to 2 channel?
Note: If you are connected to partyline, then no issues.. its working fine, and I am using the latest version of eggdrop.
The script has no code that would tie any of it's commands to anything having to do with partyline access at all!!
Replying (or not) to any of the commands created by the script are controlled only by the userfile flags for a user.
Seems to me the bot isn't replying to a user because they either don't have the required flags,
or they don't match any of the current masks for an allowed user in the bot's userfile.
Each command in the script has it's own allowed flags setting,
make sure each user you wish to use the commands has the correct user file flags for those commands.
They will also need a host mask that will match their current nick!user@host info, or the bot will not respond to them.
I will load the script and do some testing but...
Each command in the script also has a 'listen channel(s)' setting,
to control what channels are active for each command.
You MUST set the active 'listen channel(s)' for EACH of the commands in the script!
There are 5 different 'listen channel(s)' settings in the script set up,
All of them need to be set to the channels you wish the script to monitor for the corresponding commands.
Are you setting the userfile flags for users as global or channel specific?
If setting channel specific flags for users,
maybe they don't have the channel specific flag required to use the command in #channel2.
I will load and test the script to see how it works from here, and make another post with my results.
# ByRequest.tcl Version 1.1 (24 Mar 2013) #
# author: SpiKe^^ #
# e-mail: spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #
# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html #
########### General Text File Settings ###########
# Set the full route & file name of the file to edit #
# Note: The !req <message> command will attempt to make this file if needed.
set byReq(file) {/usr/home/spike/eggdrop/scripts/byreq.txt}
########### Public 'Add Request' Command Settings ###########
## settings for the public !req <message> command ##
# Set the listen channel(s) for !req <message> command #
set byReq(achan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the !req <message> command #
set byReq(aflags) {R|R}
# Set the public trigger for the !req <message> command #
# to add a request at the end of the file:
# example: !req I want coke.
set byReq(add) {!req}
########### Public 'Read Requests' Commands Settings ###########
## settings for the public !reqview <req#> and !reqlist commands ##
# Set the listen channel(s) for the public Read Requests commands #
set byReq(rchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Read Requests commands #
set byReq(rflags) {o|o}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(rhow) "1"
# Set the public trigger for the !reqview <req#> / !reqview <handle> command #
# to read a specific request (by line number) from the text file
# example: !reqview 4
# note: use to check for correct line before doing !reqedit or !reqdone
# to read all requests by <handle> from the text file
# example: !reqview spike
set byReq(read) {!reqview}
# Set the public trigger for the !reqlist command #
# to read all requests from the text file
# example: !reqlist
set byReq(readf) {!reqlist}
########### Public 'Edit/Delete Requests' Commands Settings ###########
## settings for the public !reqedit <req#> and !reqdone <req#> commands ##
# Set the listen channel(s) for the public Edit/Delete Requests commands #
set byReq(echan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Edit/Delete Requests commands #
set byReq(eflags) {m|m}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(ehow) "1"
# Set the public trigger for the !reqedit <req#> <new text> command #
# to edit a specific request (by line number) in the text file
# example: !reqedit 4 coke is not good for health.
set byReq(edit) {!reqedit}
# Set the public trigger for the !reqdone <req#> command #
# to delete a specific request (by line number) from the text file
# example: !reqdone 4
# note: this will renumber all requests after request 4!
set byReq(del) {!reqdone}
########### Public 'Delete All Requests' Command Settings ###########
## settings for the public !reqpurge command ##
# Set the listen channel(s) for the public Delete All Requests command #
set byReq(dchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Delete All Requests command #
set byReq(dflags) {n|n}
# Should this command reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(dhow) "1"
# Set the public trigger for the !reqpurge command #
# to delete all requests from the text file
# example: !reqpurge
set byReq(delf) {!reqpurge}
########### Public 'Set/Read User Comment' Commands Settings ###########
## settings for the public !userlink and !requser commands ##
# Set the listen channel(s) for the public Set/Read User Comment commands #
set byReq(uchan) {#yourchannel #anotherchannel #someotherchan}
# Set the access flags to use the public Set/Read User Comment commands #
set byReq(uflags) {n|n}
# Should these 2 commands reply by Public or User Notice ?? #
# 1 = reply by public to the channel
# 2 = reply by user notice
set byReq(uhow) "2"
# Set the public trigger for the !userlink command #
# to set the comment field for a handle in the bot's user file
# example: !userlink spike www.mytclscripts.com
set byReq(setc) {!userlink}
# Set the public trigger for the !requser command #
# to read the comment field for a handle in the bot's user file
# example: !requser spike
set byReq(user) {!requser}
################ End Settings ################
bind pub $byReq(aflags) $byReq(add) bReqProcAdd
bind pub $byReq(rflags) $byReq(read) bReqProcRead
bind pub $byReq(rflags) $byReq(readf) bReqProcReadF
bind pub $byReq(eflags) $byReq(del) bReqProcDel
bind pub $byReq(eflags) $byReq(edit) bReqProcEdit
bind pub $byReq(dflags) $byReq(delf) bReqProcDelF
bind pub $byReq(uflags) $byReq(setc) bReqProcUserS
bind pub $byReq(uflags) $byReq(user) bReqProcUser
set byReq(achan) [split [string tolower $byReq(achan)]]
set byReq(rchan) [split [string tolower $byReq(rchan)]]
set byReq(echan) [split [string tolower $byReq(echan)]]
set byReq(dchan) [split [string tolower $byReq(dchan)]]
set byReq(uchan) [split [string tolower $byReq(uchan)]]
if {$byReq(rhow) ne "2"} { set byReq(rhow) 1 }
if {$byReq(ehow) ne "2"} { set byReq(ehow) 1 }
if {$byReq(dhow) ne "2"} { set byReq(dhow) 1 }
if {$byReq(uhow) ne "2"} { set byReq(uhow) 1 }
proc bReqProcAdd {nk uh hn ch tx} {
global byReq
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $byReq(achan) $ch]=="-1"} { return 0 }
if {$tx eq ""} {
puthelp "PRIVMSG $ch :Correct syntax is: $byReq(add) <your-message-here>"
puthelp "PRIVMSG $ch :Example: $byReq(add) I want coke." ; return 0
}
set tf $byReq(file) ; set ftime [clock format [unixtime] -format %D@%R]
set id [open $tf a] ; puts $id "\[$hn\] $tx ($ftime)" ; close $id
if {![file exists $tf]} {
puthelp "PRIVMSG $ch :Unable to find or make text file: $tf"
} else { puthelp "PRIVMSG $ch :$nk: Request Accepted." }
return 0
}
proc bReqProcReadF {nk uh hn ch tx} {
bReqProcRead $nk $uh $hn $ch $tx file ; return 0
}
proc bReqProcRead {nk uh hn ch tx {do line} } {
global byReq
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $byReq(rchan) $ch]=="-1"} { return 0 }
if {$byReq(rhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$do eq "line" && $tx eq ""} {
puthelp "$pre :Correct syntax is: $byReq(read) <line# or handle>"
puthelp "$pre :Example: $byReq(read) 4"
puthelp "$pre :Example: $byReq(read) spike"
puthelp "$pre :Or type $byReq(readf) to see all pending requests." ; return 0
}
set tf $byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
if {$do eq "line"} { set tx [lindex [split $tx] 0] ; set scnt 0
if {[string is digit -strict $tx]} { set fline $tx } else { set fhand "\\\[$tx\\\] *" }
}
set tid [open $tf] ; set lnum 0
while {![eof $tid]} { set line [gets $tid]
if {$line ne ""} { incr lnum
if {$do eq "file"} { puthelp "$pre :$lnum - $line"
} elseif {[info exists fline] && $lnum==$fline} {
puthelp "$pre :$lnum - $line" ; break
} elseif {[info exists fhand] && [string match -nocase $fhand $line]} {
puthelp "$pre :$lnum - $line" ; incr scnt
}
}
}
close $tid
if {$lnum=="0"} { puthelp "$pre :$nk: There are no pending requests." ; return 0 }
if {$do eq "file"} { puthelp "$pre :List Completed - Total Pending Requests ($lnum)."
} elseif {[info exists fhand] && $scnt=="0"} { puthelp "$pre :$tx has no pending requests."
} elseif {[info exists fline] && $fline>$lnum} { set tl request
if {$lnum>"1"} { set tl requests }
puthelp "$pre :$nk: Request number $fline doesn't exist ($lnum pending $tl)."
}
return 0
}
proc bReqProcDel {nk uh hn ch tx} {
bReqProcEdit $nk $uh $hn $ch $tx del ; return 0
}
proc bReqProcEdit {nk uh hn ch tx {do edit} } {
global byReq
set ch [string tolower $ch] ; set tx [split [string trim $tx]]
if {[lsearch -exact $byReq(echan) $ch]=="-1"} { return 0 }
if {$byReq(ehow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$do eq "edit"} {
if {[llength $tx]<"2" || ![string is digit -strict [lindex $tx 0]]} {
puthelp "$pre :Correct syntax is: $byReq(edit) <req#> <new-message>"
puthelp "$pre :Example: $byReq(edit) 4 coke is not good for health." ; return 0
}
} elseif {$do eq "del" && ![string is digit -strict [lindex $tx 0]]} {
puthelp "$pre :Correct syntax is: $byReq(del) <req#>"
puthelp "$pre :Example: $byReq(del) 4" ; return 0
}
set tf $byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
set find [lindex $tx 0] ; set tx [string trim [join [lrange $tx 1 end]]]
set new [file dirname $tf]/newfile.tmp ; set nid [open $new w]
set tid [open $tf] ; set lnum 0
while {![eof $tid]} { set line [gets $tid]
if {$line ne ""} { incr lnum
if {$lnum==$find} {
if {$do eq "edit"} { set line [split $line]
set date [lindex $line end] ; set hand [lindex $line 0]
puthelp "$pre :$nk: Requests List Updated successfully."
puts $nid "$hand $tx $date"
} elseif {$do eq "del"} {
puthelp "$pre :$nk: Request Done - Deleted from the list."
}
} else { puts $nid $line }
}
}
close $tid
if {$find>$lnum} {
if {$lnum>"0"} { set tl request
if {$lnum>"1"} { set tl requests }
puthelp "$pre :$nk: Request number $find doesn't exist ($lnum pending $tl)."
} else { puthelp "$pre :$nk: There are no pending requests." }
close $nid ; file delete $new
} else { close $nid ; file rename -force $new $tf }
return 0
}
proc bReqProcDelF {nk uh hn ch tx} {
global byReq
set ch [string tolower $ch]
if {[lsearch -exact $byReq(dchan) $ch]=="-1"} { return 0 }
if {$byReq(dhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
set tf $byReq(file)
if {![file exists $tf]} {
puthelp "$pre :$nk: There are no pending requests." ; return 0
}
puthelp "$pre :$nk: All pending requests deleted successfully!"
file delete $tf ; return 0
}
proc bReqProcUserS {nk uh hn ch tx} {
bReqProcUser $nk $uh $hn $ch $tx setc ; return 0
}
proc bReqProcUser {nk uh hn ch tx {do getc} } {
global byReq
set ch [string tolower $ch] ; set tx [string trim $tx]
if {[lsearch -exact $byReq(uchan) $ch]=="-1"} { return 0 }
if {$byReq(uhow)=="2"} { set pre "NOTICE $nk" } else { set pre "PRIVMSG $ch" }
if {$tx eq ""} {
if {$do eq "getc"} { set cmd $byReq(user) ; set mor "" ; set mo2 ""
} else { set cmd $byReq(setc) ;set mor " <new-comment>" ;set mo2 " www.mytclscripts.com" }
puthelp "$pre :Correct syntax is: $cmd <handle>$mor"
puthelp "$pre :Example: $cmd spike$mo2" ; return 0
}
set rest [join [lrange [split $tx] 1 end]]
set tx [lindex [split $tx] 0]
if {![validuser $tx]} {
puthelp "$pre :$nk: $tx is not a valid user handle." ; return 0
}
if {$do eq "setc"} {
setuser $tx COMMENT $rest
puthelp "$pre :$nk: Comment for $tx set to: $rest" ; return 0
}
if {[set cmt [getuser $tx COMMENT]] eq ""} {
puthelp "$pre :$nk: There is no comment for $tx." ; return 0
}
puthelp "$pre :$nk: $tx - $cmt" ; return 0
}
putlog "ByRequest.tcl Ver. 1.1 by SpiKe^^ loaded."