| View previous topic :: View next topic |
| Author |
Message |
cuthbertx Voice
Joined: 27 Feb 2011 Posts: 4
|
Posted: Mon Feb 28, 2011 7:19 pm Post subject: Check if user is registered with NickServ |
|
|
Hello guys,
I've seen a few topics on this, and I know it is based on the network you're on, but I just can't seem to get it to work with what I am wanting. So here is a little background. I have a script that will send an invite to users who are in a database file. However, I want the script to check if the user is registered before it sends the invite. I was hoping to do something like:
if {[isregistered $nick]} {
then do this
}
Or something similar to it. I've tried a few different ways, but just can't seem to get it to work. It doesn't have to be like it is above, but something that will check if they're registered and then continue if so, or return if not.
Here is what I've tried and has been the closest:
| Code: | proc nfo:usr {nick host hand text {dest ""}} {
global zop botnick is_reg
set from "NickServ"
set is_reg "0"
if {([string match -nocase "*3*" $text]) && ([string match -nocase "NickServ" $from])} {
log "$nick is registered. 3."
set is_reg "1"
} else {
log "$nick is not registered. 0."
set is_reg "0"
}
return 0
}
proc invite {nick uhost handle arg} {
global infodb ui_entries chan_1 is_reg
bind notc - "*" nfo:usr
putquick "PRIVMSG nickserv :status $nick"
if {$is_reg == "0"} { return 0 }
|
I know the above is way off, but any help is greatly appreciated on this. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Mar 01, 2011 3:32 am Post subject: |
|
|
You send a command to NickServ to check upon a user if is registered or not, right? What's the command? Also, could you do a check on a user and write here the result? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Tue Mar 01, 2011 10:59 am Post subject: Re: Check if user is registered with NickServ |
|
|
| cuthbertx wrote: |
...
and I know it is based on the network you're on,
...
|
If possible, please post the name, etc. of the network.
It should make it a lot easier for scripters and experimenters, if they can simply log onto the network in question and play around with it for themselves, if they wish. |
|
| Back to top |
|
 |
cuthbertx Voice
Joined: 27 Feb 2011 Posts: 4
|
Posted: Tue Mar 01, 2011 12:15 pm Post subject: |
|
|
The network that I am trying this on is: irc.what-network.net -- just to test things out.
The message that is sent to nickserv to check the status is: /msg nickserv status $nick
And the response you get back is:
11:11 -NickServ(services@what-network.net)- STATUS Cuthbertx 3
The last number represents the level that the user is. Level 3 means the nick is registered and identified which is the status I am looking for on the return. The other numbers are 2, 1 and 0 which do not matter and should all return false.
Thanks for your help guys. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Tue Mar 01, 2011 1:43 pm Post subject: |
|
|
| cuthbertx wrote: | The network that I am trying this on is: irc.what-network.net -- just to test things out.
...
|
| Code: |
bind pub - "!getstatus" getnickstatus
bind notc - "*STATUS*" noticereply
proc getnickstatus {nick uhost handle chan text} {
putserv "privmsg nickserv :status [lindex [split $text] 0]"
}
proc noticereply {nick uhost handle text dest} {
if {"$nick"!="NickServ"} {
return
}
if {"[lindex [split $text] 2]" == "3"} {
# this user is online, registered, and id'd with Nickserv
# do whatever commands here
} else {
# this user did not return "3"
# do whatever commands here
}
}
|
Experiment with something like the above.
I tried very briefly , on your server, and it worked. In place of the comments, I had putserv commands to send me a simple /msg , so that has been edited after pasting it here.
This little bit of code is not meant to be a drop in. It is just meant to illustrate one way to check for that "3" that I think you are wanting to test for.
I hope this helps. |
|
| Back to top |
|
 |
cuthbertx Voice
Joined: 27 Feb 2011 Posts: 4
|
Posted: Tue Mar 01, 2011 11:59 pm Post subject: |
|
|
Thank you for the reply. Going to work with you have provided and see if I can get it going. I'll let ya know if I get it going and share it  |
|
| Back to top |
|
 |
|