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.

Kick users after a certain amount of time spent in the chan

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

something odd. it was working fine after while start giving error

Code: Select all

[11H:09m:1693999830s] Tcl error [idknotice]: Unknown channel setting.
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Well... idlekick-checktime is the delay between 2 checks of the idle, channel get $chan idlekick-time is the code to use
Yusif wrote:something odd. it was working fine after while start giving error

Code: Select all

[11H:09m:1693999830s] Tcl error [idknotice]: Unknown channel setting.
Sure. idlekick-checktime IS NOT a channel setting. Read my previous sentence.
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

thanks, but the [channel get $chan idlekick-time] , still do not get time in the msg:

Code: Select all

putserv "PRIVMSG $nick :You'll be kicked after [channel get $chan idlekick-time] minutes"
msg came like : You'll be kicked after X minutes

it didn't show number of minutes where it should be as X
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Checked with the following script:

Code: Select all

# idlekick.tcl version 1.1.1 by TCL_no_TK <ispmailsucks@googlemail.com>
#
# this script was written for user qetuoadgjl on egghelp.org forums
#   Post: http://forum.egghelp.org/viewtopic.php?t=15543
#
# Kicks users after a set about of idle time, configurable via dcc chanset command.
# Ability to warn users before kicking and banning them, and other punishment options.
#
# Usage:
# .chanset <#channel> +idlekick
# .chanset <#channel> idlekick-time <time(minets)>
#
##

# time in minets to check channels for idlers? (default: 10)
set idlekick_checktime "2"

# set your IRCd's kick length below (default: 150)
#  -- note, some networks all 255. but 150 should be safe :)
set idlekick_kicklength "10"

# set the kick message
set idlekick_kickmsg "3Idling is 4NOT4 3allowed"

# Set the warn message
set idlekick_warnmsg "3Ask your 4QUESTION "

# warn the user a minet before the set idle time for the channel?
#  -- this should allow you to inform the user better, that they will be kicked in a minet if they contine to idle. ;p
# 1/0 = yes/no
set idlekick_loseit "1"

# Punishment Options
# 1 = kick the user.
# 2 = kick and ban the user.
# 3 = warn and kick the user.
# 4 = warn, kick and ban the user.
# 5 = warn the user.
set idlekick_punish "3"

#code
proc time:idlekick {minuet hour day month year} {
global idlekick_loseit idlekick_punish
 foreach channel [channels] {
  if {[channel get $channel idlekick] == "+" && [botisop $channel]} {
   foreach iu [chanlist $channel] {
    if {![isbotnick $iu] && [onchan $iu $channel] && ![isop $iu $channel] && ![ishalfop $iu $channel] && ![isvoice $iu $channel]} {
     if {$idlekick_loseit == 1 && [expr [channel get $channel idlekick-time] -1] == [getchanidle $iu $channel]} {
      switch $idlekick_punish {
       "1" {idle:kick "$channel $iu"}
       "2" {idle:kickban "$channel $iu"}
       "3" {idle:warnkick "$channel $iu"}
       "4" {idle:warnkickban "$channel $iu"}
       "5" {idle:warn "$channel $iu"}
      }
     }
     if {$idlekick_loseit == 0 && [channel get $channel idlekick-time] == [getchanidle $iu $channel]} {
      switch $idlekick_punish {
       "1" {idle:kick "$channel $iu"}
       "2" {idle:kickban "$channel $iu"}
       "3" {idle:warnkick "$channel $iu"}
       "4" {idle:warnkickban "$channel $iu"}
       "5" {idle:warn "$channel $iu"}
      }
     }
    }
   }
  }
 }; return
}

proc idle:kick {text} {
global idlekick_kickmsg idlekick_kicklength
 set chan [lindex [split $text] 0]
  set nick [lindex [split $text] 1]
   if {[onchan $nick $chan] && [botisop $chan]} {
    putserv "KICK $chan $nick :[trimchars "$idlekick_kickmsg  $idlekick_kicklength"]"
   }; return
}

proc idle:kickban {text} {
global idlekick_kickmsg idlekick_kicklength
 set chan [lindex [split $text] 0]
  set nick [lindex [split $text] 1]
   if {[onchan $nick $chan] && [botisop $chan]} {
    putserv "MODE $chan +b *!*@[lindex [split [getchanhost $nick] "@"] 1]"
    putserv "KICK $chan $nick :[trimchars "$idlekick_kickmsg  $idlekick_kicklength"]"
   }; return
}

proc idle:warnkick {text} {
global idlekick_loseit
 idle:warn "$text"
  if {$idlekick_loseit == 1} {
   utimer 54 {idle:kick "$text"}
  } else {
   idle:kick "$text"
  }; return
}

proc idle:warnkickban {text} {
global idlekick_loseit
 idle:warn "$text"
  if {$idlekick_loseit == 1} {
   utimer 54 {idle:kickban "$text"}
  } else {
   idle:kickban "$text"
  }; return
}

proc idle:warn {text} {
global idlekick_warnmsg
 set chan [lindex [split $text] 0]
  set nick [lindex [split $text] 1]
   if {[onchan $nick $chan]} {
    puthelp "NOTICE $nick :$idlekick_warnmsg"
   }; return
}

proc trimchars {text} {
 set chars [lrange "$text" 0 [expr [llength "$text"] -1]]
  set trim [lrange "$text" end end]
   return [join [lrange "[split "$chars" {}]" 0 $trim] {}]
}

proc idknotice {nick uhost handle chan} {
   putserv "PRIVMSG $nick :You'll be kicked after [channel get $chan idlekick-time] minutes"
}

#channel options
setudef flag idlekick
setudef str idlekick-time

#binds
bind time - "$idlekick_checktime * * * *" time:idlekick
bind join - "#zeolia *" idknotice

#end
putlog "loaded idlekick.tcl version 1.1.1 by TCL_no_TK"
return 
Joined #zeolia (the channel in my bind) after having .chanset #zeolia idlekick-time 30:

Code: Select all

15:59:21 <Raspdrop> You'll be kicked after 30 minutes
NB: I corrected a line in the idle:kickban proc
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

tested with above script

Code: Select all

[17:24] <~Autobot> TriNiTy :You'll be kicked after  minutes
time "number of minutes" still not there
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Show the result of .chaninfo #help
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

here the info

Code: Select all

<Yusif> .chaninfo #help
<Autobot> Settings for dynamic channel #help:
<Autobot> Protect modes (chanmode): +tn
<Autobot> Idle Kick after (idle-kick): DON'T!
<Autobot> stopnethack: DON'T!
<Autobot> aop-delay: 5:30
<Autobot> revenge-mode: 0
<Autobot> ban-type: 2
<Autobot> ban-time: 360
<Autobot> exempt-time: 0
<Autobot> invite-time: 0
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

It's incomplete, look at mine:
.chaninfo #zeolia
[17:20] tcl: builtin dcc call: *dcc:chaninfo CrazyCat 9 #zeolia
Settings for dynamic channel #zeolia:
Protect modes (chanmode): +tn
Idle Kick after (idle-kick): DON'T!
stopnethack: DON'T!
aop-delay: 5:30
revenge-mode: 0
ban-type: 3
ban-time: 120
exempt-time: 60
invite-time: 60
Other modes:
-inactive -statuslog -secret +shared
+greet -seen +cycle +dontkickops
+protectops -protectfriends -revenge -revengebot
-bitch -autoop -autovoice -nodesynch
-enforcebans +dynamicbans +userbans -autohalfop
-protecthalfops -static
+dynamicexempts +userexempts +dynamicinvites +userinvites
User defined channel flags:
-advjoin -idlekick
User defined channel settings:
advdelay: 0 idlekick-checktime: 2
User defined channel strings:
idlekick-time: 30
flood settings: chan ctcp join kick deop nick
number: 15 3 5 3 3 5
time : 60 60 60 10 10 60
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

here

Code: Select all

<Yusif> .chaninfo #help
<Autobot> Settings for dynamic channel #help:
<Autobot> Protect modes (chanmode): +tn
<Autobot> Idle Kick after (idle-kick): DON'T!
<Autobot> stopnethack: DON'T!
<Autobot> aop-delay: 5:30
<Autobot> revenge-mode: 0
<Autobot> ban-type: 2
<Autobot> ban-time: 360
<Autobot> exempt-time: 0
<Autobot> invite-time: 0
<Autobot> Other modes:
<Autobot>      -inactive       -statuslog      -secret         +shared
<Autobot>      +greet          -seen           +cycle          +dontkickops
<Autobot>      -protectops     -protectfriends -revenge        -revengebot
<Autobot>      -bitch          +autoop         -autovoice      +nodesynch
<Autobot>      +enforcebans    +dynamicbans    +userbans       -autohalfop
<Autobot>      -protecthalfops -static
<Autobot>      +dynamicexempts +userexempts    +dynamicinvites +userinvites
<Autobot> User defined channel flags:
<Autobot>      -idlekick
<Autobot> User defined channel strings:
<Autobot> idlekick-time: {}
<Autobot> flood settings: chan ctcp join kick deop nick
<Autobot> number:           15    3    5    3    3    5
<Autobot> time  :           60   60   60   10   10   60
<Autobot> [15H:09m:1694014321s] #Yusif# chaninfo #help
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

<Autobot> idlekick-time: {}
If you didn't set idlekick-time, it's an empty string.

And you didn't set +idlekick neither, so the script won't warn or kick.

Read the comments of the script:

Code: Select all

# Usage:
# .chanset <#channel> +idlekick
# .chanset <#channel> idlekick-time <time(minets)> 
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

what you mean i didn't set +idlekick ?
i tried the script you told me to try only change room to #help instead #zeolia
and the code still same

Code: Select all

# Usage:
# .chanset <#channel> +idlekick
# .chanset <#channel> idlekick-time <time(minets)>
and yes it not warn nor kick only msg on join
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

In party-line, do:

Code: Select all

.chanset #help +idlekick
.chanset #help idlekick-time 30
That's exactly what is said in the script.
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

thank you CC for all help.
i did exactly what you showed me here

Code: Select all

# Usage:
# .chanset <#help> +idlekick
# .chanset <#help> idlekick-time 10
the msg on join still come with out numbers of minutes i set

Code: Select all

[19:14] <~Autobot> TriNiTy :You'll be kicked after  minutes
and the result of .chaninfo #help still same

Code: Select all

<Autobot> idlekick-time: {}
not sure what i'm missing
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Copy & paste exactly exactly what you type and see in your party-line.
Must give something like:

Code: Select all

.chanset #help +idlekick
Successfully set modes { +idlekick  } on #help.
.chanset #help idlekick-time 30
Successfully set modes { idlekick-time { 30 } } on #help.
The error is from you as the script works well and is really simple.
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

here the result

Code: Select all

<Yusif> .chanset #help +idlekick
<Autobot> Successfully set modes { +idlekick  } on #help.
<Autobot> [16H:09m:1694105303s] #Yusif# chanset #help +idlekick
<Yusif> .chanset #help idlekick-time 10
<Autobot> Successfully set modes { idlekick-time { 10 } } on #help.
<Autobot> [16H:09m:1694105382s] #Yusif# chanset #help idlekick-time { 10 }
after i did that the on join msg came with time

Code: Select all

-Autobot- You'll be kicked after 10 minutes
will see if warn and kick will processed or not
Post Reply