This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

auto op on certain nick

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

auto op on certain nick

Post by holycrap »

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!

:D
User avatar
Anahel
Halfop
Posts: 48
Joined: Fri Jul 03, 2009 6:18 pm
Location: Dom!

Post by Anahel »

Code: Select all

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)
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

And change

Code: Select all

if {![isvoice $nn $chan]} { 
to

Code: Select all

if {![isop $nn $chan]} { 
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: auto op on certain nick

Post by willyw »

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!

:D
Here's another take on it:

Code: Select all

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: Select all

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?
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Re: auto op on certain nick

Post by holycrap »

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. :D
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: auto op on certain nick

Post by willyw »

holycrap wrote: ...
@willyw, it's a long story, but this is exactly what I'm looking for. Much thanks for your time. :D

You are quite welcome. :)
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

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: Select all

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. :)
Last edited by Luminous on Wed Aug 04, 2010 12:55 am, edited 1 time in total.
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

@Luminous, wickedly kewl! 8) 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. :D
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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: Select all

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

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.
Post Reply