silentziler wrote:
... im looking to add a line to check to see if a user has identified with nickserv before ...
The problem is: It isn't just one line, to do it.
What comes to mind - as a way to do it - is to send a whois to the server, wait for the return, then operate on that that return using raw binds.
If you load this:
Code: Select all
# September 13, 2015
# It seems like it is not unusual for someone to need a way to check if a nick is currently identified with Nickserv, or not.
#
# This will /whois the nick passed to it, and see if the line exists that shows that nick is logged in
#
#
# A global variable - $id_toggle - will be set. "1" if nick is identified, "0" if not.
# NOTE !!
# Since this script sends a /whois to the server, there can be a lag! Beware of this, and allow for it, in your scripts that
# may call this one, and use the value of $id_toggle
# Reference : https://www.alien.net.au/irc/irc2numerics.html
# Also, to see the raw numerics returned by your server, before you try to use this script:
# do: .console +r (must already be enabled in eggdrop.conf) to turn on the raw flag in console flags.
# then do: .dump whois <somenick>
# bot will do a /whois on somenick, and since you have raw logging on, you will be able to see the return.
# note the raw numerics.
# test on both a nick that is currently id'd with Nickserv, and one that is not.
# ( do: .console -r to turn off raw logging when done )
#
proc is_nick_idd {nick} {
global id_toggle
bind raw - "307" is_idd
bind raw - "330" is_idd
set id_toggle "0"
putserv "whois $nick"
utimer 7 [list unbind raw - "307" is_idd]
utimer 7 [list unbind raw - "330" is_idd]
}
proc is_idd {from key text} {
global id_toggle
set id_toggle "1"
}
and just consider it as a command to be used:
is_nick_idd somenick_here
like that, it will set a variable to either "1" or "0".
The variable is named:
$id_toggle
and you can then do an if statement that checks that in whatever other script you need to use it in.
The catch ! :
The can be a lag or delay in the server responding to the whois command sent to it. You must allow for this, by introducing some delay into whatever script will be testing the value of $id_toggle.
Also, there is nothing built into this very basic script if the server returns an error or something like that.
I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !