Code: Select all
# nsinfo.tcl
set vNsinfoServices "nickserv@services.dal.net"
set vNsinfoChannel #eggtcl
bind PUB - !nsinfo pNsinfoSend
bind NOTC - * pNsinfoReceive
proc pNsinfoSend {nick uhost hand chan text} {
global vNsinfoChannel vNsinfoServices
if {[string equal -nocase $chan $vNsinfoChannel]} {
set target [string tolower [regsub -all -- {[\s]{2,}} [string trim $text] { }]]
if {[llength [split $target]] == 1} {
if {[regexp -- {^[\x41-\x7D][-\d\x41-\x7D]*$} $target]} {
putserv "PRIVMSG $vNsinfoServices :INFO $target"
} else {putserv "PRIVMSG $vNsinfoChannel :$target is not a valid nick"}
} else {putserv "PRIVMSG $vNsinfoChannel :correct usage !nsinfo <nick>"}
}
return 0
}
proc pNsinfoReceive {nick uhost hand text dest} {
global vNsinfoChannel vNsinfoServices
if {([isbotnick $dest]) && ([string match -nocase ${nick}* $vNsinfoServices])} {
set msg [stripcodes bcruag [string trim $text]]
if {[string match -nocase "*info for*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*currently on irc*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*last seen address*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*last seen time*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*time registered*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*time now*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*options: *" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*end of info*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*is not registered*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*is frozen*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
} elseif {[string match -nocase "*cannot be registered*" $msg]} {
putserv "PRIVMSG $vNsinfoChannel :$msg"
}
}
return 0
}
putlog "nsinfo.tcl loaded"
# eof