I'm developing an script and I need to catch Nickserv response (user mode, specifically). The server's nickserv says this:
Returns whether the user(s) using the given nickname is recognized as the owner of the nickname. The response has this format:
nickname status-code
where nickname is the nickname sent with the command, and status-code is one of the following:
0 - no such user online or nickname not registered
1 - user not recognized as nickname's owner
2 - user recognized as owner via access list only
3 - user recognized as owner via password identification
What I need is an tcl code to send through /msg something like "/msg nickserv status JohnDoe", and the Nickserv answer needs to be stored on some variable (Nickserv always answer like "JohnDoe 3"). Then I can would use this number (0, 1, 2 or 3) after.
# Septermber 21, 2015
# http://forum.egghelp.org/viewtopic.php?t=20044
# What I need is an tcl code to send through /msg something like "/msg nickserv status JohnDoe", and the Nickserv answer needs to be
# stored on some variable (Nickserv always answer like "JohnDoe 3"). Then I can would use this number (0, 1, 2 or 3) after.
# Usage:
# !nickstatus <nick>
#
bind pub - "!nickstatus" do_nick_status
bind notc - "*status*" status_notice
proc do_nick_status {nick uhost handle chan text} {
if {![llength [split $text]]} {
putserv "privmsg $chan :Syntax: !nickstatus <nick> "
return 0
}
putserv "privmsg Nickserv :status [lindex [split $text] 0]"
}
proc status_notice {nick uhost handle text dest} {
# Bot will output on this channel. Just needed somewhere to have
# it put the values, so you can see them.
set chan "#testchan1"
if {[string tolower $nick] ne "nickserv"} {
return 0
}
if {[string tolower [lindex [split $text] 0]] ne "status"} {
return 0
}
set status_nick [lindex [split $text] 1]
set status_value [lindex [split $text] 2]
putserv "privmsg $chan : "
putserv "privmsg $chan :status_nick is: $status_nick"
putserv "privmsg $chan :status_value is: $status_value"
}
With a couple brief tests on an irc network that has what seems to be the same Status command, it worked.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !