Système de bannissement d'utilisateur qui idle trop longtemps sur un salon d'aide - mecmec - 06/08/2019
Hello,
Je cherche un moyen d'avertir de façon automatique les personnes inactives dans un salon d'aide en leur envoyant une notice au bout de 10 minutes, et 5 minutes après la personne se fait kickban du salon d'aide.
Voici ce que j'ai trouvé:
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 #aide +idlekick
# .chanset #aide idlekick-time 1
#
##
# 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 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
# 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 4
#channel options
setudef flag idlekick
setudef str idlekick-time
#binds
bind time -|- "2 * * * *" time:idlekick
#code
proc time:idlekick {min hour day month year} {
global idlekick_loseit idlekick_punish
puthelp "PRIVMSG #aide :test"
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] {}]
}
#end
putlog "loaded idlekick.tcl version 1.1.1 by TCL_no_TK"
#return
Sans oublier de taper:
Citation :# .chanset #aide +idlekick
# .chanset #aide idlekick-time 1
Toutefois il ne fonctionne pas sur une version Eggdrop 1.8.4, le problème pourrait venir d'où ? Est-ce que le tcl est obsolète ?
Dans le proc time:idlekick j'ai mis ceci à la 3eme ligne et "test" ne s'affiche même pas comme si que le timer ne fonctionnait pas:
Code : puthelp "PRIVMSG #aide :test"
Cordialement
M.M
RE: Système de bannissement d'utilisateur qui idle trop longtemps sur un salon d'aide - CrazyCat - 06/08/2019
Ce TCL me semble inachevé:
- La variable idlekick_checktime n'est utilisée nulle part
- la procédure time:idlekick n'est appelée que lorsqu'il est l'heure + 2 minutes (01h02, 06h02, 23h02...) => il faudrait un bind cron
- le calcul pour savoir si l'utilisateur doit être kické (ou averti) se fait sur une égalité ([expr [channel get $channel idlekick-time] -1] == [getchanidle $iu $channel] ), donc un utilisateur qui a un idle supérieur ne sera pas kické. => mettre un <=
- Les procédures appelées après timer par idle:warnkick et idle:warnkickban ne tiennent pas compte de l'idle, donc si une personne a parlé après être averti, elle sera tout de même kickée
RE: Système de bannissement d'utilisateur qui idle trop longtemps sur un salon d'aide - mecmec - 07/08/2019
Mince d'accord dans le forum http://forum.egghelp.org/viewtopic.php?t=15543 l'auteur il dit qu'il n'a pas testé, il a dû faire ça à l'arrache.
RE: Système de bannissement d'utilisateur qui idle trop longtemps sur un salon d'aide - bouba89 - 12/08/2019
(07/08/2019, 05:10)mecmec a écrit : Mince d'accord dans le forum http://forum.egghelp.org/viewtopic.php?t=15543 l'auteur il dit qu'il n'a pas testé, il a dû faire ça à l'arrache.
Bonjour,
j'ai un tcl sur un sapart a toi de le modifié a ta guise
Code : ### 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 1
# Ban time in minutes.
set bantime 5
# Kick's reason
set aidlereason "Auto Sapart - aucune question n'as ete faite durant 5min"
# Exception's flags
set flags f|f
# Kick op? (0 = Yes, 1 = No)
set kickop 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 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 {([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 "sapart $nick $channel" }
1 { newchanban $channel "*![getchanhost $nick]" "Auto Sapart" "aucune question n'as ete faite durant 5min" $bantime }
}
}
putlog "Anti-Idle v1.2 loaded"
RE: Système de bannissement d'utilisateur qui idle trop longtemps sur un salon d'aide - CrazyCat - 15/08/2019
(12/08/2019, 17:35)bouba89 a écrit : (07/08/2019, 05:10)mecmec a écrit : Mince d'accord dans le forum http://forum.egghelp.org/viewtopic.php?t=15543 l'auteur il dit qu'il n'a pas testé, il a dû faire ça à l'arrache.
Bonjour,
j'ai un tcl sur un sapart a toi de le modifié a ta guise
Ce script ne prévient pas, il fait un kick (pourquoi utiliser sapart ?) ou un ban après un certain idle.
@mecmec : je suis actuellement loin des écrans (et des claviers) mais je vais tâcher de faire un petit script qui réponde à ton besoin.
|