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 

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

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


Joined: 26 Feb 2008
Posts: 11

PostPosted: Mon Mar 17, 2008 3:01 pm    Post subject: Kick users after a certain amount of time spent in the chan Reply with quote

Okay I know there are a few aidle on here already, but none of them are exactly what I'm looking for!

Okay so, we need a maximum stay tcl, which will kick users say after 15 minutes or however many minutes we specify as we run a help channel and don't want a bunch of idlers in the room. we need an option to make it channel specific as we have alot of bots running in various rooms. Also, we don't want it kicking our ops or voices etc just people with no voice, no half ops, no ops soone. and if it could notice the user 5 minutes before they will be kicked warning them, that would be good, but no crucial! lol

ty all
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Tue Mar 18, 2008 1:49 am    Post subject: Reply with quote

Quote:
Usage:
.chanset <#channel> +idlekick
.chanset <#channel> idlekick-time <time(minets)>

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

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

# set the kick message
set idlekick_kickmsg "idle lamer"

# Set the warn message
set idlekick_warnmsg "how lame are you? Mr I idle in a help channel"

# 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"

# Punishments
# 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 "4"

# 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] {}]
}

# channel options
setudef flag idlekick
setudef str idlekick-time

# binds
bind time - "$idlekick_checktime * * * *" time:idlekick

#end
putlog "loaded idlekick.tcl version 1.1 by TCL_no_TK"
return
Not tested, and sorry for spelling/grammer mistakes Embarassed

P.S Just FYI, MC_8's idle script should be able to do this. linkage:http://forum.purehype.net/phpBB3/viewtopic.php?f=32&t=697

EDIT: fixed erorr mentioned in post below. Very Happy Thanks
EDIT [2]: fixed error, extra '}' in one of idle: procs
EDIT [3]: switched kickban, to ban first.
_________________
TCL the misunderstood


Last edited by TCL_no_TK on Thu Mar 20, 2008 11:29 pm; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail
speechles
Revered One


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

PostPosted: Tue Mar 18, 2008 2:11 am    Post subject: Reply with quote

Code:
putserv "KICK $chan $nick :[trimchars $idlekick_kickmsg  $idlekick_kicklength]"
...snipped irrelevant sections...
proc trimchars {text} {

Do you see the problem here? Your incorrectly invoking trimchars with too many parameters.

Code:
putserv "KICK $chan $nick :[trimchars "$idlekick_kickmsg  $idlekick_kicklength"]"

This is how you should do it. Notice trimchars see's a single parameter built with two variables now, not two seperate parameters. You also don't need to worry about the tcl interpreter evaluating those double-quotes incorrectly either. Because of how tcl works, by the time the putserv is invoked (the 1st set of double-quotes), the trimchars section will have already been evaluated (the 2nd set of double-quotes). Escaping any of them will lead to a tcl error, above is correct.
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Tue Mar 18, 2008 2:07 pm    Post subject: Reply with quote

Thanks Smile glad its nothin to worry about Razz
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Wed Mar 19, 2008 1:39 am    Post subject: Reply with quote

@TCL_no_TK

You should release that script, it will be useful for others in future if anyone needs something like that. Will definately benefit others. Smile

Just a friendly suggestion
peace
death
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Mar 23, 2008 5:11 am    Post subject: Reply with quote

Submitted Smile Thanks Cool
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Fahad
Op


Joined: 29 Aug 2016
Posts: 127

PostPosted: Sun Mar 26, 2017 10:20 am    Post subject: Reply with quote

This TCL is not working... At ALL
Back to top
View user's profile Send private message
Fahad
Op


Joined: 29 Aug 2016
Posts: 127

PostPosted: Sun Mar 26, 2017 10:25 am    Post subject: Reply with quote

Code:

# 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] {}]
}

#channel options
setudef flag idlekick
setudef str idlekick-time

#binds
bind time - "$idlekick_checktime * * * *" time:idlekick

#end
putlog "loaded idlekick.tcl version 1.1.1 by TCL_no_TK"
return
Back to top
View user's profile Send private message
Fahad
Op


Joined: 29 Aug 2016
Posts: 127

PostPosted: Sun Mar 26, 2017 10:26 am    Post subject: Reply with quote

TCL_no_TK wrote:
Submitted Smile Thanks Cool


This DOES not KICK the USER NOT WORKING
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 398

PostPosted: Tue May 19, 2020 12:17 pm    Post subject: Reply with quote

Sorry, I know this is a old post but i kind of want to make it (finished)

this script seems to work for me Very Happy

to turn on this is script as TCL_no_TK said

Quote:

.chanset <#channel> +idlekick
.chanset <#channel> idlekick-time <time(minets)>

_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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