| View previous topic :: View next topic |
| Author |
Message |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Dec 21, 2014 9:39 pm Post subject: help please tcl of no idles |
|
|
it is necessary to this tcl to add a list of ignored but I could not any friend who helps me to add such a list example: set nohostcops {
this tcl has a time error this message leaves in partyline
[21:33] <RoBoCoP> [01:33:00] Tcl error [idlekick:tick]: wrong # args: should be "timer minutes command"
| Code: | # How to use:
# 1) Enable on channels you wish to use it on:
# .chanset #example +idlekick
#
# 2) Configure how long users are allowed to idle (in minutes)
# .chanset #example idlekick-time 15
#
# 3) You may configure the messages below.
# Warning message
set warningmsg "Warning! You will be kicked in 18 minute due to our anti-idle policy."
# Kick message
set kickmsg "sorry no idle please - this channel has an anti-idle policy."
# How many minutes ban user for.
set bantime 5
# ------------------------------------------------------------------------------------
setudef flag idlekick
setudef str idlekick-time
## nicksname to ignore
set nonicksirpat {
"bopm"
"AdminServ"
"sedition"
"master"
"eggy"
"OperHelp"
"Arnold_X-P"
}
## vhost or ips to ignore
set nohostcops {
"*.Speed.org*"
"*.Administrator.org*"
"*.proxie.scan*"
"*190.ix.server.tor.us*"
"*.tu.ReY.es*"
"*Staff.latinchat*"
"*Staff.Speed.org*"
"*ChiQuiTiTa.es*"
"*.Network.Administrator*"
"*VicioChat.Org*"
}
bind time - "* * * * *" idlekick:tick
proc idlekick:tick {minute hour day month year} {
foreach channel [channels] {
if {[channel get $channel idlekick] == "1" && [botisop $channel]} {
foreach iu [chanlist $channel] {
if {![isbotnick $iu] && [onchan $iu $channel] && ![isop $iu $channel]
&& ![ishalfop $iu $channel] && ![isvoice $iu $channel]} {
if {[getchanidle $iu $channel] == [expr [channel get $channel idlekick-time] -1]} {
idlekick:warn $channel $iu
}
if {[getchanidle $iu $channel] >= [channel get $channel idlekick-time]} {
idlekick:kick $channel $iu
}
}
}
}
}
}
proc idlekick:warn {channel nick uhost} {
global warningmsg nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
set nickhost [lindex [split [getchanhost $nick] "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime putserv "MODE $channel -b *!*@$nickhost"
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
}
} |
_________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Dec 21, 2014 11:44 pm Post subject: |
|
|
Try this... | Code: |
# How to use:
# 1) Enable on channels you wish to use it on:
# .chanset #example +idlekick
#
# 2) Configure how long users are allowed to idle (in minutes)
# .chanset #example idlekick-time 15
#
# 3) You may configure the messages below.
# Warning message
set warningmsg "Warning! You will be kicked in 18 minute due to our anti-idle policy."
# Kick message
set kickmsg "sorry no idle please - this channel has an anti-idle policy."
# How many minutes ban user for.
set bantime 5
# ------------------------------------------------------------------------------------
setudef flag idlekick
setudef str idlekick-time
## nicksname to ignore
set nonicksirpat {
"bopm"
"AdminServ"
"sedition"
"master"
"eggy"
"OperHelp"
"Arnold_X-P"
}
## vhost or ips to ignore
set nohostcops {
"*.Speed.org*"
"*.Administrator.org*"
"*.proxie.scan*"
"*190.ix.server.tor.us*"
"*.tu.ReY.es*"
"*Staff.latinchat*"
"*Staff.Speed.org*"
"*ChiQuiTiTa.es*"
"*.Network.Administrator*"
"*VicioChat.Org*"
}
bind time - "* * * * *" idlekick:tick
proc idlekick:tick {minute hour day month year} {
foreach ch [channels] {
if {[channel get $ch idlekick] == "1" && [botisop $ch]} {
foreach iu [chanlist $ch] {
if {![isbotnick $iu]&&[onchan $iu $ch]&&![isop $iu $ch]&&![ishalfop $iu $ch]&&![isvoice $iu $ch]} {
if {[getchanidle $iu $ch] == [expr [channel get $ch idlekick-time] -1]} {
idlekick:warn $ch $iu
}
if {[getchanidle $iu $ch] >= [channel get $ch idlekick-time]} {
idlekick:kick $ch $iu
}
}
}
}
}
}
proc idlekick:warn {channel nick uhost} {
global warningmsg nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
set nickhost [lindex [split [getchanhost $nick] "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime [list putserv "MODE $channel -b *!*@$nickhost"]
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Mon Dec 22, 2014 1:15 am Post subject: |
|
|
the tcl works well
add a section to ignore vhost or ips and so the tcl omits the content of this list
but on having created this list, it went out new errors.
| Quote: |
<RoBoCoP> [05:01:00] Tcl error [idlekick:tick]: wrong # args: should be "idlekick:kick channel nick uhost"
|
earlier
| Code: |
proc idlekick:warn {channel nick } {
set nohostcops {
"*.Speed.org*"
"*.Administrator.org*"
"*.proxie.scan*"
"*190.ix.server.tor.us*"
"*.tu.ReY.es*"
"*Staff.latinchat*"
"*Staff.Speed.org*"
"*ChiQuiTiTa.es*"
"*.Network.Administrator*"
"*VicioChat.Org*"
}
current
proc idlekick:warn {channel nick uhost} {
++++
proc idlekick:warn {channel nick uhost} {
global warningmsg nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
set nickhost [lindex [split [getchanhost $nick] "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime [list putserv "MODE $channel -b *!*@$nickhost"]
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
}
|
_________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Wed Dec 24, 2014 11:13 pm Post subject: |
|
|
Give this a try... | Code: |
# How to use:
# 1) Enable on channels you wish to use it on:
# .chanset #example +idlekick
#
# 2) Configure how long users are allowed to idle (in minutes)
# .chanset #example idlekick-time 15
#
# 3) You may configure the messages below.
# Warning message
set warningmsg "Warning! You will be kicked in 1 minute due to our anti-idle policy."
# Kick message
set kickmsg "Sorry no idle please - This channel has an anti-idle policy."
# How many minutes ban user for.
set bantime 5
## nicksname to ignore
set exemptnicks {
bopm
AdminServ
sedition
master
eggy
OperHelp
Arnold_X-P
}
## vhost or ips to ignore
set exempthosts {
*.Speed.org
*.Administrator.org
*.proxie.scan*
*190.ix.server.tor.us
*.tu.ReY.es
*Staff.latinchat*
*Staff.Speed.org
*ChiQuiTiTa.es
*.Network.Administrator*
*VicioChat.Org
}
# ----------------------------------------------------------------------------------
setudef flag idlekick
setudef str idlekick-time
set exemptnicks [split [string trim $exemptnicks] "\n"]
set exempthosts [split [string trim $exempthosts] "\n"]
bind time - "* * * * *" idlekick:tick
proc idlekick:tick {minute hour day month year} {
global exemptnicks
foreach ch [channels] {
if {[channel get $ch idlekick] && [botisop $ch]} {
set maxidle [channel get $ch idlekick-time]
set warntime [expr {$maxidle - 1}]
foreach iu [chanlist $ch] {
if {[isbotnick $iu] || ![onchan $iu $ch] || [isop $iu $ch]} { continue }
if {[ishalfop $iu $ch] || [isvoice $iu $ch]} { continue }
if {[lsearch -nocase $exemptnicks $iu]>"-1"} { continue }
set idletime [getchanidle $iu $ch]
if {$idletime == $warntime} {
idlekick:warn $ch $iu [getchanhost $iu $ch]
} elseif {$idletime >= $maxidle} {
idlekick:kick $ch $iu [getchanhost $iu $ch]
}
}
}
}
return 0
}
proc idlekick:warn {channel nick uhost} {
global warningmsg exempthosts
foreach {hostmask} $exempthosts {
if {[string match -nocase [string trim $hostmask] $uhost]} { return 0 }
}
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime exempthosts
foreach {hostmask} $exempthosts {
if {[string match -nocase [string trim $hostmask] $uhost]} { return 0 }
}
set nickhost [lindex [split $uhost "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime [list putserv "MODE $channel -b *!*@$nickhost"]
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
| EDIT: Note: This script requires tcl version 8.5+
Good luck. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Wed Dec 24, 2014 11:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Wed Dec 24, 2014 11:22 pm Post subject: |
|
|
the tcl works of marvel
thank you very much friend, SpiKe^^ you always helping me and thanks for being a big person and friend
Merry Christmas friend and Merry Christmas to all those who help  _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Wed Dec 24, 2014 11:40 pm Post subject: |
|
|
an error went out in partyline:
<RoBoCoP> [03:37:00] Tcl error [idlekick:tick]: bad option "-nocase": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -inline, -integer, -not, -real, -regexp, -sorted, or -start
my eggdrop use tcl Tcl: 8.4
that one seems to be the cause of that my bot is using an ancient tcl
[23:37] <Arnold_X-P> .tcl info tclversion
[23:37] <RoBoCoP> Tcl: 8.4
friend might create one that is compatible with 8.4 and 8.5 and 8.6
thanksss _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Wed Dec 24, 2014 11:45 pm Post subject: One last try. |
|
|
This should get you around the old tcl issue:) | Code: |
# How to use:
# 1) Enable on channels you wish to use it on:
# .chanset #example +idlekick
#
# 2) Configure how long users are allowed to idle (in minutes)
# .chanset #example idlekick-time 15
#
# 3) You may configure the messages below.
# Warning message
set warningmsg "Warning! You will be kicked in 1 minute due to our anti-idle policy."
# Kick message
set kickmsg "Sorry no idle please - This channel has an anti-idle policy."
# How many minutes ban user for.
set bantime 5
## nicksname to ignore
set exemptnicks {
bopm
AdminServ
sedition
master
eggy
OperHelp
Arnold_X-P
}
## vhost or ips to ignore
set exempthosts {
*.Speed.org
*.Administrator.org
*.proxie.scan*
*190.ix.server.tor.us
*.tu.ReY.es
*Staff.latinchat*
*Staff.Speed.org
*ChiQuiTiTa.es
*.Network.Administrator*
*VicioChat.Org
}
# ----------------------------------------------------------------------------------
setudef flag idlekick
setudef str idlekick-time
set exemptnicks [split [string tolower [string trim $exemptnicks]] "\n"]
set exempthosts [split [string trim $exempthosts] "\n"]
bind time - "* * * * *" idlekick:tick
proc idlekick:tick {minute hour day month year} {
global exemptnicks
foreach {ch} [channels] {
if {[channel get $ch idlekick] && [botisop $ch]} {
set maxidle [channel get $ch idlekick-time]
set warntime [expr {$maxidle - 1}]
foreach {nk} [chanlist $ch] {
if {[isbotnick $nk] || ![onchan $nk $ch] || [isop $nk $ch]} { continue }
if {[ishalfop $nk $ch] || [isvoice $nk $ch]} { continue }
if {[lsearch -exact $exemptnicks [string tolower $nk]]>"-1"} { continue }
set idletime [getchanidle $nk $ch]
if {$idletime == $warntime} {
idlekick:warn $ch $nk [getchanhost $nk $ch]
} elseif {$idletime >= $maxidle} {
idlekick:kick $ch $nk [getchanhost $nk $ch]
}
}
}
}
return 0
}
proc idlekick:warn {channel nick uhost} {
global warningmsg exempthosts
foreach {hostmask} $exempthosts {
if {[string match -nocase [string trim $hostmask] $uhost]} { return 0 }
}
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime exempthosts
foreach {hostmask} $exempthosts {
if {[string match -nocase [string trim $hostmask] $uhost]} { return 0 }
}
set nickhost [lindex [split $uhost "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime [list putserv "MODE $channel -b *!*@$nickhost"]
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Thu Dec 25, 2014 10:22 am Post subject: Re: One last try. |
|
|
very quite friendly, now if the tcl works to the perfection
once again I want to be grateful to him for its time and help
and to say to him Merry Christmas and happy new year.  _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
abah Halfop
Joined: 01 Dec 2013 Posts: 61 Location: Indonesia
|
Posted: Tue Apr 14, 2015 4:37 am Post subject: |
|
|
if I do not want to use .chanset #channel
if anything needs in fox so I do not need to use it ? |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Apr 14, 2015 8:42 am Post subject: |
|
|
| Code: |
# Warning message
set idlekick(warn) "Warning! You will be kicked in 1 minute due to our anti-idle policy."
# Kick message
set idlekick(kick) "Sorry no idle please - This channel has an anti-idle policy."
# How many minutes for max amount of idle time in minutes
set idlekick(maxidle) 15
# How many minutes ban user for.
set idlekick(bantime) 5
## nicksname to ignore
set idlekick(nicks) {
bopm
AdminServ
sedition
master
eggy
OperHelp
Arnold_X-P
}
## vhost or ips to ignore
set idlekick(hosts) {
*.Speed.org
*.Administrator.org
*.proxie.scan*
*190.ix.server.tor.us
*.tu.ReY.es
*Staff.latinchat*
*Staff.Speed.org
*ChiQuiTiTa.es
*.Network.Administrator*
*VicioChat.Org
}
bind time - * idlekick:tick
proc idlekick:tick {minute hour day month year} {
global idlekick
foreach chan [channels] {
if {![botisop $chan]} continue
set userlist [lreplace [chanlist $chan] 0 0]
foreach user [split $userlist] {
if {![onchan $user $chan] || [isop $user $chan]} continue
if {[ishalfop $user $chan] || [isvoice $user $chan]} continue
if {[lsearch -nocase $idlekick(nicks) $user] != -1} continue
set matched 0
set uhost [getchanhost $user $chan]
foreach mask $idlekick(hosts) {
if {[string match -nocase $mask $uhost]} {
set matched 1
break
}
}
if {$matched} continue
set idletime [getchanidle $user $chan]
set warntime [expr {$idlekick(maxidle) - 1}]
if {$idletime == $warntime} {
idlekick:act "warn" $chan $user
} elseif {$idletime >= $idlekick(maxidle)} {
idlekick:act "kick" $chan $user $user!$uhost
}
}
}
}
proc idlekick:act {act chan nick {uhost ""}} {
global idlekick
switch -- $act {
default {
return
}
"warn" {
putlog "ANTIIDLE: Warning $nick on $chan due to idling"
puthelp "PRIVMSG $chan :$nick: $idlekick(warn)"
}
"kick" {
putlog "ANTIIDLE: Banning $nick on $chan due to idling"
scan $uhost {%[^!]!%[^@]@%s} nick user host
pushmode $chan +b "*!*@$host"
putkick $chan $nick $idlekick(kick)
utimer [expr $idlekick(bantime) * 60] [list idlekick:act unban $chan $nick "*!*@$host"]
}
"unban" {
if {![botisop $chan]} return
if {[ischanban $uhost $chan]} {
pushmode $chan -b $uhost
}
}
}
}
}
|
Haven't tested so give it a try and report back if you get any errors.
Edit: Fixed typo. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Wed Apr 15, 2015 4:27 am; edited 3 times in total |
|
| Back to top |
|
 |
abah Halfop
Joined: 01 Dec 2013 Posts: 61 Location: Indonesia
|
Posted: Tue Apr 14, 2015 11:51 pm Post subject: |
|
|
i try about that but dont work anything sir maybe any wrong sir ? |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Apr 15, 2015 12:58 am Post subject: |
|
|
Edited the above post and fixed a typo and a missing variable. Should be working fine now.
Also noticed and didn't fix was the fact that the idlekick(bantime) in the original code is said to be in minutes, yet by using utimer this is actually in seconds. So you got two options: either define idlekick(bantime) in seconds or need to add something to do the math for us to turn the minutes into seconds utimer needs.
So for example if where to go with option A and define idlekick(bantime) in seconds then multiply 5 by 60 to get actual seconds.
If where to go with option B then change:
| Code: |
utimer $idlekick(bantime) [list pushmode $chan -b "*!*@$host"]
|
with:
| Code: |
utimer [expr $idlekick(bantime) * 60] [list pushmode $chan -b "*!*@$host"]
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
abah Halfop
Joined: 01 Dec 2013 Posts: 61 Location: Indonesia
|
Posted: Thu Apr 16, 2015 2:57 am Post subject: |
|
|
still not working sir  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Apr 16, 2015 5:15 am Post subject: |
|
|
Did you copy the code again? Because I have edited my previous post and did some changes in it. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
abah Halfop
Joined: 01 Dec 2013 Posts: 61 Location: Indonesia
|
Posted: Thu Apr 16, 2015 5:31 am Post subject: |
|
|
| caesar wrote: | | Did you copy the code again? Because I have edited my previous post and did some changes in it. |
please check my code
| Code: | set idlekick(warn) "Warning! You will be kicked in 1 minute due to our anti-idle policy."
set idlekick(kick) "Sorry no idle please - This channel has an anti-idle policy."
set idlekick(maxidle) 15
set idlekick(bantime) 5
set idlekick(nicks) {
abah
izzah
adinda
ameliyah
dinda
fakhrunnisa
musmed
yuli
geulis
lulu
nia
rina
susi
jundi
juli
nurafifah
vina
lidya
}
set idlekick(hosts) {
*.ukhuwah.net
}
bind time - * idlekick:tick
proc idlekick:tick {minute hour day month year} {
global idlekick
foreach chan [channels] {
if {![botisop $chan]} continue
set userlist [lreplace [chanlist $chan] 0 0]
foreach user [split $userlist] {
if {![onchan $user $chan] || [isop $user $chan]} continue
if {[ishalfop $user $chan] || [isvoice $user $chan]} continue
if {[lsearch -nocase $idlekick(nicks) $user] != -1} continue
set matched 0
set uhost [getchanhost $user $chan]
foreach mask $idlekick(hosts) {
if {[string match -nocase $mask $uhost]} {
set matched 1
break
}
}
if {$matched} continue
set idletime [getchanidle $user $chan]
set warntime [expr {$idlekick(maxidle) - 1}]
if {$idletime == $warntime} {
idlekick:act "warn" $chan $user
} elseif {$idletime >= $idlekick(maxidle)} {
idlekick:act "kick" $chan $user $uhost
}
}
}
}
proc idlekick:act {act chan user {uhost ""}} {
global idlekick
switch -- $act {
default {
return
}
"warn" {
putlog "ANTIIDLE: Warning $user on $chan due to idling"
puthelp "PRIVMSG $channel :$user: $idlekick(warn)"
}
"kick" {
putlog "ANTIIDLE: Banning $user on $chan due to idling"
scan $uhost {%[^!]!%[^@]@%s} nick user host
pushmode $chan +b "*!*@$host"
putkick $chan $user $idlekick(kick)
utimer $idlekick(bantime) [list pushmode $chan -b "*!*@$host"]
}
"unban" {
if {![botisop $chan]} return
if {[ischanban $uhost $chan]} {
pushmode $chan -b $uhost
}
}
}
} |
and you code
| Code: | set idlekick(warn) "Warning! You will be kicked in 1 minute due to our anti-idle policy."
set idlekick(kick) "Sorry no idle please - This channel has an anti-idle policy."
set idlekick(maxidle) 15
set idlekick(bantime) 5
set idlekick(nicks) {
abah
izzah
adinda
ameliyah
dinda
fakhrunnisa
musmed
yuli
geulis
lulu
nia
rina
susi
jundi
juli
nurafifah
vina
lidya
}
set idlekick(hosts) {
*.ukhuwah.net
}
bind time - * idlekick:tick
proc idlekick:tick {minute hour day month year} {
global idlekick
foreach chan [channels] {
if {![botisop $chan]} continue
set userlist [lreplace [chanlist $chan] 0 0]
foreach user [split $userlist] {
if {![onchan $user $chan] || [isop $user $chan]} continue
if {[ishalfop $user $chan] || [isvoice $user $chan]} continue
if {[lsearch -nocase $idlekick(nicks) $user] != -1} continue
set matched 0
set uhost [getchanhost $user $chan]
foreach mask $idlekick(hosts) {
if {[string match -nocase $mask $uhost]} {
set matched 1
break
}
}
if {$matched} continue
set idletime [getchanidle $user $chan]
set warntime [expr {$idlekick(maxidle) - 1}]
if {$idletime == $warntime} {
idlekick:act "warn" $chan $user
} elseif {$idletime >= $idlekick(maxidle)} {
idlekick:act "kick" $chan $user $uhost
}
}
}
}
proc idlekick:act {act chan user {uhost ""}} {
global idlekick
switch -- $act {
default {
return
}
"warn" {
putlog "ANTIIDLE: Warning $user on $chan due to idling"
puthelp "PRIVMSG $channel :$user: $idlekick(warn)"
}
"kick" {
putlog "ANTIIDLE: Banning $user on $chan due to idling"
scan $uhost {%[^!]!%[^@]@%s} nick user host
pushmode $chan +b "*!*@$host"
putkick $chan $user $idlekick(kick)
utimer $idlekick(bantime) [list pushmode $chan -b "*!*@$host"]
}
"unban" {
if {![botisop $chan]} return
if {[ischanban $uhost $chan]} {
pushmode $chan -b $uhost
}
}
}
}
} |
|
|
| Back to top |
|
 |
|