I have a tcl script which detects smilies flood and, when needed, kick or ban the user. Because the bot isn't always op/halfop I have a :
Code: Select all
if {![botisop $channel] && ![botishalfop $channel]} {
return 0
}
See the entire function here :
Code: Select all
proc scanner:punish:smileyparty {nick uhost channel} {
if {![botisop $channel] && ![botishalfop $channel]} { return 0 }
# Protection des +f
if {[matchattr [nick2hand $nick $channel] "f"]} {
putserv "NOTICE $nick :On se calme, mon ami(e)..."
return 0
}
global flood_Oo_punish flood_Oo_list
if {[info exists flood_Oo_punish($uhost)]} {
if {$flood_Oo_punish($uhost) == 1} {
set flood_Oo_punish($uhost) 2
putkick $channel $nick "J'aime pas tes smilies, alors arrête."
return 1
} elseif {$flood_Oo_punish($uhost) == 2} {
set flood_Oo_punish($uhost) 3
set bhost [mkbhost $uhost 1]
newchanban $channel $bhost Liantop "\[Smiley Party] T'as pas compris ? J'ai dit STOP" 5
putkick $channel $nick "T'as pas compris ? J'ai dit STOP"
return 1
} elseif {$flood_Oo_punish($uhost) == 3} {
set flood_Oo_punish($uhost) 4
set bhost [mkbhost $uhost 2]
newchanban $channel $bhost Liantop "\[Smiley Party] J'ai horreur de me répéter. Reste dehors." 15
putkick $channel $nick "J'ai horreur de me répéter. Reste dehors."
return 1
} else {
set flood_Oo_punish($uhost) 4
set bhost [mkbhost $uhost 2]
newban $bhost Liantop "\[Flood Smiley] Tu veux jouer au con, tu vas perdre." 4320
putkick $channel $nick "Tu veux jouer au con, tu vas perdre."
}
} else {
set flood_Oo_punish($uhost) 1
putserv "NOTICE $nick : Arrête tes smileys, sinon tu vas mal finir."
}
}
Using tcl 8.4 and eggdrop 1.6.16
Any idea ?