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 

auto op on certain nick

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


Joined: 21 Jan 2008
Posts: 152

PostPosted: Sun Aug 01, 2010 7:45 pm    Post subject: auto op on certain nick Reply with quote

Hi guys,

Can you guys code me a quick tcl file? Here's what I'm looking for.

Some sort of a list (of nicks), and if the nick joined the channel and his/her nick matches the list, the bot will give it op access. The bot checks the nick and not the host of the nick.

Many thanks!

Very Happy
Back to top
View user's profile Send private message
Anahel
Halfop


Joined: 03 Jul 2009
Posts: 48
Location: Dom!

PostPosted: Sun Aug 01, 2010 8:31 pm    Post subject: Reply with quote

Code:
setudef flag tagvoice

bind join - {% somenick*} voice:user
bind nick - {% somenick*} voice:user



proc voice:user {nick uhost hand chan {nn ""}} {
 if {$nn == ""} {set nn $nick}
 if {![isvoice $nn $chan]} {
  pushmode $chan +o $nn
 }
}


it's just modified tcl for voicing ppl, just edit "somenick" to what do you want and it should work (it's working for me when i want to give hop for certain nick in my channel)
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Sun Aug 01, 2010 10:19 pm    Post subject: Reply with quote

And change
Code:
if {![isvoice $nn $chan]} {
to
Code:
if {![isop $nn $chan]} {

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Aug 01, 2010 11:20 pm    Post subject: Re: auto op on certain nick Reply with quote

holycrap wrote:

...
Some sort of a list (of nicks), and if the nick joined the channel and his/her nick matches the list, the bot will give it op access. The bot checks the nick and not the host of the nick.

Many thanks!

Very Happy


Here's another take on it:


Code:

bind join - "% *" opbylist

proc opbylist {nick uhost handle chan} {

set opfile "scripts/opfile.txt"
set opinfo [open $opfile r]

set data [read -nonewline $opinfo]
close $opinfo

set lines [split $data "\n"]
   
foreach opcheck $lines {
   if {"[string tolower $opcheck]"=="[string tolower $nick]"} {
      pushmode $chan +o $nick
      }   

   }
}


See the line: "scripts/opfile.txt" above. You need to create a plain text file, in your scripts directory, named opfile.txt.
(If you wish to keep the file elsewhere, change the path accordingly)
In this file, put one nick per line
Code:

bill
john
jack
billybob
somenick


When one of these nicks joins, it will be op'd.
With a couple of quick tests, it worked for me.

Caution: this is a really insecure way to op.

But, if I understood your request correctly, this is exactly what you asked for.

Perhaps if you could describe with more detail exactly what you need, we could come up with better ideas for you. What I have done here, .... if you use it, will let anybody get op'd, simply by leaving, changing their nick to a known op's nick that is not in the channel at the moment, and joining again.
I can't see this as a desirable thing.

Is there a reason that you cannot use Eggdrop's built in userlist? (It is secure.)
I see that you specifically mentioned to avoid using hostmask... why?
Back to top
View user's profile Send private message
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Mon Aug 02, 2010 1:23 am    Post subject: Re: auto op on certain nick Reply with quote

Thanks, you guys are awesome!

@willyw, it's a long story, but this is exactly what I'm looking for. Much thanks for your time. Very Happy
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Aug 02, 2010 11:33 am    Post subject: Re: auto op on certain nick Reply with quote

holycrap wrote:

...
@willyw, it's a long story, but this is exactly what I'm looking for. Much thanks for your time. Very Happy



You are quite welcome. Smile
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Mon Aug 02, 2010 11:06 pm    Post subject: Reply with quote

I changed a few things and added the option off adding a nick and deleting a nick via pub commands, rather than having to mess with the actual file itself. I have to say though that you would be better of writing the host of the user rather than the nick... nicks are horribly insecure for opping. </disclaimer>

Code:

bind join - "% *" opbylist
proc opbylist {nick uhost handle chan} {
set opfile "scripts/opfile.txt"
    set opinfo [open $opfile r]
    set lines [split [read -nonewline $opinfo] \n]
close $opinfo
    foreach opcheck $lines {
        if {[string match -nocase "$nick" $opcheck]} {
      putquick "MODE $chan +o $nick"
        }
 return
    }
}

bind pub o|o !addop addop
proc addop {nick host hand chan text} {
    set newop [join [lindex [split $text] 0]]
    set ops [open "scripts/opfile.txt"]
    set nicks [split [read -nonewline $ops] \n]
 close $ops
    if {![llength $nicks]} {
        set ops [open "scripts/opfile.txt" w]
    } else {
        set ops [open "scripts/opfile.txt" a]
    }
    foreach line $nicks {
        if {[string match -nocase "$newop" $line]} {
     putquick "NOTICE $nick :$newop is already in opfile."
 return
        }
    }
 puts $ops "$newop"
   close $ops
}

bind pub o|o !delop delop
proc delop {nick host hand chan text} {
    set delop [join [lindex [split $text] 0]]
    set ops [open "scripts/opfile.txt"]
    set nicks [split [read -nonewline $ops] \n]
 close $ops
    if {![llength $nicks]} {
   putquick "NOTICE $nick :Opfile is empty, nothing to delete."
 return
    }
    set line [lsearch -exact $nicks "$delop" ]
    set newops [lreplace $nicks $line $line]
    set ops [open "scripts/opfile.txt" w]
    puts $ops [join $newops "\n"]
  close $ops
}


Hope you like it. Smile


Last edited by Luminous on Wed Aug 04, 2010 12:55 am; edited 1 time in total
Back to top
View user's profile Send private message
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Tue Aug 03, 2010 5:26 am    Post subject: Reply with quote

@Luminous, wickedly kewl! Cool And thanks for the heads up guys on the insecure part for adding nicks instead of hosts. On that note... when I'm in partyline with the bot... what's the command to add/remove users from the bot op's list?

Thanks for all the help. Very Happy
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Aug 03, 2010 10:09 am    Post subject: Reply with quote

holycrap wrote:

...
when I'm in partyline with the bot... what's the command to add/remove users from the bot op's list?



This command changes the flags assigned to a user:
Code:

.chattr <handle> [changes] [channel]


But to really get an explanation:
http://www.egghelp.org/commands/core.htm#chattr
( After you read it, be *sure* to notice the line that says: To get a list of the flags possible, do .help whois. Smile )

You'll probably want to check out these, too:
http://www.egghelp.org/commands/irc.htm#adduser
and/or
http://www.egghelp.org/commands/core.htm#+user

Along with:
http://www.egghelp.org/commands/core.htm#whois
and
http://www.egghelp.org/commands/core.htm#match

This is the main page, to all the above:
http://www.egghelp.org/commands/index.htm
and is well worth bookmarking.


I hope this helps.
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