Code: Select all
bind pub n !join join:pub
proc join:pub {nick host hand chan arg} {
channel add [lindex $arg 0]
putserv "PRIVMSG $chan :Bot is joining \(\002[lindex $arg 0]\002\)."
}
Code: Select all
bind pub m .+chan pub:+chan
bind pub m .-chan pub:-chan
#part
proc pub:-chan {nick uhost hand chan args} {
set args [cleanarg $args]
if {[llength $args]<1} {
notice $nick "Usage: .-chan <#channel>"
return 0
}
channel remove $args
}
#join
proc pub:+chan {nick uhost hand chan args} {
set args [cleanarg $args]
if {[llength $args]<1} {
notice $nick "Usage: .+chan <#channel>"
return 0
}
channel add $args {+greet -bitch -autoop -bitch -stopnethack}
}
Code: Select all
set args [split [cleanarg $args]]
But why do we need to use this complicated process??proc cleanarg {arg} {
set response ""
for {set i 0} {$i < [string length $arg]} {incr i} {
set char [string index $arg $i]
if {($char != "\12") && ($char != "\15")} {
append response $char
}
}
return $response
}