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 

Identify with nickserv before autop op

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
silentziler
Voice


Joined: 09 Sep 2015
Posts: 11

PostPosted: Wed Sep 09, 2015 11:09 am    Post subject: Identify with nickserv before autop op Reply with quote

Hello egghelp,

So im currently using AutoopNick.tcl By CoMMy / kirian100@yahoo.com
and im looking to add a line to check to see if a user has identified with nickserv before autoping. I removed the first IF line as it doesnt matter the channel.
I was just wondering if its possible to add an ident check before it reads the autooplist.txt and maybe kick back a not registered with nickserv if a user isnt.

Code:
proc join_check {nick host handle chan} {
  global botnick
  if {![channel get $chan autoopnick]} {return 0}
  set fp [open scripts/autooplist.txt r]
  set lines [split [read $fp] \n]
  set idx [lsearch -glob $lines "$nick"]
  if {$idx != -1} {
    putquick "MODE $chan +o $nick"
    close $fp
  } else {
    close $fp
    return 0
  }
  return 1
}

Thanks for any help.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Sep 13, 2015 12:30 pm    Post subject: Re: Identify with nickserv before autop op Reply with quote

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. Smile

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:


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


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Sep 13, 2015 12:34 pm    Post subject: Re: Identify with nickserv before autop op Reply with quote

silentziler wrote:


... if its possible to add an ident check before it reads the autooplist.txt



Coincidentally, I just did something like this for an acquaintance.
However, for simplicity, I didn't bother with having the bot keep a text list, opening and closing and searching it.

We just add the users to the bot's user list with either .adduser or .+user ,
and use that list.

It seems a lot less complicated. Smile
_________________
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
silentziler
Voice


Joined: 09 Sep 2015
Posts: 11

PostPosted: Mon Sep 14, 2015 9:11 am    Post subject: Re: Identify with nickserv before autop op Reply with quote

Hey willyw,

Just wanted to say thanks for the suggestion!
I will play with this code and see if I can't make something of it!

I kinda figured it would be a pain in the rear, I did all kinds of research before
coming here for help. I didnt see to many people with this question, so i figured I would reach out for help.

Thanks again!
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Sep 14, 2015 1:58 pm    Post subject: Re: Identify with nickserv before autop op Reply with quote

You're welcome.

Good luck with it all.
It is fun to work through, once you get rolling.
_________________
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
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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