Code: Select all
namespace eval ChanSet {
bind pub n|n .chanset [namespace current]::chanset
proc chanset {nick uhost hand chan text} {
if {[scan $text {%s%s} mode value] < 1} {
puthelp "NOTICE $nick :Error, usage: $::lastbind +/-<channel mode> \[value\]"
return
}
if {![string last - $mode]} {
set what [string map {- ""} $mode]
} else {
set what [string map {+ ""} $mode]
}
if {[catch {channel get $chan $what} err]} {
puthelp "NOTICE $nick :Error, \002$what\002 is an unkown channel setting."
return
}
if {[info exists value]} {
channel set $chan $mode $value
puthelp "NOTICE $nick :Channel mode $what has been set to $value"
} else {
channel set $chan $mode
puthelp "NOTICE $nick :Channel mode $what has been set to [expr {[string first + $mode] > -1 ? "enabled" : "disabled"}]."
}
}
}