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 

A small adjustment

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


Joined: 26 Dec 2008
Posts: 205
Location: Quakenet, #Football

PostPosted: Thu Jun 16, 2011 11:47 am    Post subject: A small adjustment Reply with quote

Hey, need a small adjustment for this script.

Need an exception for someone using the nick 'ZoD' i.e. the bot won't deop him no matter how long he's idle. please help.
Code:
# Channel
variable opchan "#Football"

# Idle time in minutes
variable idletime 60

bind time - "* * * *" deop_user
if {![info exists oplist]} { set oplist "" }

proc deop_user {a b c d e} {
    global opchan idletime oplist
    set users [lrange [chanlist $opchan] 1 end]

    foreach user $users {
        if {[getchanidle $user $opchan] >= $idletime && [isop $user $opchan] && ![isbotnick $user]} {

            # Oprotate exemption: check if the user is a qualified op. If he/she is then check if without them there
            # would be any qualified ops left. If not, then do not deop the user (requires oprotate.tcl to be loaded)

            if {[namespace exists oprotate] && [channel get $opchan oprotate] && [oprotate::user_is_qualified_op $opchan $user] && [oprotate::find_best_qualified_op $opchan $user] == ""} {
               
                # You can remove the line below (the putlog, not the return!) if this message is too spammy ;)
                putlog "oprotate/deop: Not going to deop $user in $opchan because they are the only qualified op left."
                return
            }

            pushmode $opchan "-o" $user
            lappend oplist [getchanhost $user $opchan]

        } elseif {[getchanidle $user $opchan] < $idletime && ![isop $user $opchan] && [lsearch -exact $oplist [getchanhost $user $opchan]] != -1} {
            pushmode $opchan "+o" $user
        }
    }
}

_________________
Idling at #Football, Quakenet.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Thu Jun 16, 2011 2:10 pm    Post subject: Reply with quote

Code:
# Channel
variable opchan "#Football"

# build your exempt list here, use lowercase for matching purposes.
variable exempted_from_deop [list "nick1" "nick2" "nick3" "etc"]

# Idle time in minutes
variable idletime 60

bind time - "* * * *" deop_user
if {![info exists oplist]} { set oplist "" }

proc deop_user {a b c d e} {
   global opchan idletime oplist exempted_from_deop
   set users [lrange [chanlist $opchan] 1 end]

   foreach user $users {
      if {[getchanidle $user $opchan] >= $idletime && [isop $user $opchan] && ![isbotnick $user] && [lsearch -exact $exempted_from_deop [string tolower $user]] == -1} {

         # Oprotate exemption: check if the user is a qualified op. If he/she is then check if without them there
         # would be any qualified ops left. If not, then do not deop the user (requires oprotate.tcl to be loaded)

         if {[namespace exists oprotate] && [channel get $opchan oprotate] && [oprotate::user_is_qualified_op $opchan $user] && [oprotate::find_best_qualified_op $opchan $user] == ""} {

            # You can remove the line below (the putlog, not the return!) if this message is too spammy Wink
            putlog "oprotate/deop: Not going to deop $user in $opchan because they are the only qualified op left."
            return
         }

         pushmode $opchan "-o" $user
         lappend oplist [getchanhost $user $opchan]

      } elseif {[getchanidle $user $opchan] < $idletime && ![isop $user $opchan] && [lsearch -exact $oplist [getchanhost $user $opchan]] != -1} {
         pushmode $opchan "+o" $user
      }
   }
}
########################################################################################defeatWordWrap########################################################################################

_________________
speechles' eggdrop tcl archive


Last edited by speechles on Thu Jun 16, 2011 9:33 pm; edited 2 times in total
Back to top
View user's profile Send private message
Football
Master


Joined: 26 Dec 2008
Posts: 205
Location: Quakenet, #Football

PostPosted: Wed Jun 22, 2011 3:20 am    Post subject: Reply with quote

Works great! thanks speechless!
_________________
Idling at #Football, Quakenet.
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