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.

script won't kick

Help for those learning Tcl or writing their own scripts.
Post Reply
o
opsb
Halfop
Posts: 41
Joined: Sat Sep 01, 2007 1:41 pm

script won't kick

Post by opsb »

Code: Select all

### Anti-Idle v1.2
### by Progeny <progeny@azzurra.org>
### irc.azzurra.org - #EggHelp

# - Using -
# Type in partyline:
# .chanset #channel maxidle <time in minutes>
# If set 0 channel's check will be ignored.

# Punishing method (1 = Kick, 2 = Kick/Ban)
set pmethod 2
# Ban time in minutes.
set bantime 6
# Kick's reason
set aidlereason "Presli ste limit dopustenog idle vremena na kanalu #pomoc"
# Exception's flags
set flags f|f
# Kick op? (0 = Yes, 1 = No)
set kickop 1
# Kick halfop? (0 = Yes, 1 = No)
set kickhalfop 1
# Kick voice? (0 = Yes, 1 = No)
set kickvoice 1
# Check for idling users every minutes.
bind time - * aidle:checkidle

setudef int maxidle

proc aidle:checkidle { min hour day month year } {
global botnick flags kickop kickhalfop kickvoice
	foreach chan [channels] {
		if {![channel get $chan "maxidle"]} {continue}
		foreach nick [chanlist $chan] {
			if {$nick == $botnick} {continue}
			if {([isop $nick $chan]) && ($kickop)} {continue}
			if {([ishalfop $nick $chan]) && ($kickhalfop)} {continue}
			if {([isvoice $nick $chan]) && ($kickvoice)} {continue}
			if {[matchattr [nick2hand $nick] $flags] == 1} {continue}
			if {[getchanidle $nick $chan] > [channel get $chan "maxidle"]} {
			aidle:punish $chan $nick [channel get $chan "maxidle"]
			}
		}
	}
}

proc aidle:punish { channel nick idletime } {
global pmethod aidlereason bantime
regsub -all "%idletime" $aidlereason $idletime aidlereason
	switch $pmethod {
	1 { putserv "KICK $channel $nick :$aidlereason" }
	2 { newchanban $channel "*![getchanhost $nick]" "Anti-Idle" $aidlereason $bantime }
	}
}


putlog "Anti-Idle v1.2 loaded"
I'm now using this script
I've edited it for these lines

Code: Select all

# Kick halfop? (0 = Yes, 1 = No)
set kickhalfop 1
and

Code: Select all

if {([ishalfop $nick $chan]) && ($kickhalfop)} {continue}
Firstly, it worked.. but now.. script won't kick from channel, just ban and that's all

thnx
M
Maiki
Voice
Posts: 28
Joined: Sun May 20, 2007 4:58 pm

Post by Maiki »

Try this proc=

Code: Select all

proc aidle:checkidle { min hour day month year } {
global botnick flags kickop kickhalfop kickvoice
   foreach chan [channels] {
      if {![channel get $chan "maxidle"]} {continue}
      foreach nick [chanlist $chan] {
         if {$nick == $botnick} {continue}
         if {[isop $nick $chan] && $kickop == "1"} {continue}
         if {[ishalfop $nick $chan] && $kickhalfop == "1"} {continue}
         if {[isvoice $nick $chan] && $kickvoice == "1"} {continue}
         if {[matchattr [nick2hand $nick] $flags] == "1"} {continue}
         if {[getchanidle $nick $chan] > [channel get $chan "maxidle"]} { aidle:punish $chan $nick [channel get $chan "maxidle"] }
      }
   }
} 
o
opsb
Halfop
Posts: 41
Joined: Sat Sep 01, 2007 1:41 pm

Post by opsb »

Again same but just for some nicks..

Some nicks are kicked-banned, and other just banned, and that's all
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Code: Select all

proc aidle:checkidle { min hour day month year } { 
   foreach chan [channels] { 
      if {![channel get $chan "maxidle"]} {continue} 
      foreach nick [chanlist $chan] { 
         if {[getchanidle $nick $chan] > [channel get $chan "maxidle"]} { 
         aidle:punish $chan $nick [channel get $chan "maxidle"] 
         } 
      } 
   } 
}
When the bot is required to kick/ban ops/voice/halfops then you don't need to put it in the script so make it less confusing. Try with this code I hope it should work fine :D

peace
death
|AmDeAtH @ Undernet
Death is only the *Beginning*...
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Could you tell me the setting for "strict-hosts", and also, did you notice any pattern with kicks/bans and wether the users ident is prefixed with ~, -, +, =, or ^.

I would argue that the source of this issue is not within aidle:checkidle, but rather aidle:punish since the eggdrop reacts on all, but behaves differently on different offenders.
Only banning would be consistent with eggdrop not properly detecting a matching internal ban - often caused by improper bans with "strict-host".
NML_375
o
opsb
Halfop
Posts: 41
Joined: Sat Sep 01, 2007 1:41 pm

Post by opsb »

Code: Select all

[02:50:05] * eggBot (eggbot@eggdrop.dedica.org) has joined #pomoc
[02:50:06] ChanServ set[s] mode[s]: +o eggBot
[02:51:24] eggBot set[s] mode[s]: -o+b Apollo *!Apollo@levat.dedica.org
[02:51:26] eggBot set[s] mode[s]: +b *!~br0nx@BB38BD7D.B92574B6.945CAD23.IP
[02:51:28] eggBot set[s] mode[s]: +b *!docs@docs.dedica.org
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Code: Select all

.chanset #chan +enforcebans
?
Have you ever read "The Manual"?
Post Reply