egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Catching nickserv response

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Hoden
Voice


Joined: 21 Sep 2015
Posts: 2

PostPosted: Mon Sep 21, 2015 4:41 pm    Post subject: Catching nickserv response Reply with quote

I'm developing an script and I need to catch Nickserv response (user mode, specifically). The server's nickserv says this:

Quote:
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.

Thanks in advance.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Sep 21, 2015 8:59 pm    Post subject: Re: Catching nickserv response Reply with quote

Hoden wrote:
I'm developing an script ....


So you know some TCL , and just need a rough example?

Quote:

... and the Nickserv answer needs to be stored on some variable ...
Then I can would use this number (0, 1, 2 or 3) after.
...


Play around with this:

Code:


# 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 !
Back to top
View user's profile Send private message
Hoden
Voice


Joined: 21 Sep 2015
Posts: 2

PostPosted: Mon Oct 19, 2015 3:01 pm    Post subject: Reply with quote

This script works very nice, thank you!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber