BT.antichanflood.tcl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ####################### ANTICHANFLOOD TCL ###########################
  6. #########################################################################
  7. ## ##
  8. ## BlackTools : http://blacktools.tclscripts.net ##
  9. ## Bugs report : http://www.tclscripts.net/ ##
  10. ## GitHub page : https://github.com/tclscripts/BlackToolS-TCL ##
  11. ## Online Help : irc://irc.undernet.org/tcl-help ##
  12. ## #TCL-HELP / UnderNet ##
  13. ## You can ask in english or romanian ##
  14. ## ##
  15. #########################################################################
  16. proc antifloodchan:protect {nick host hand chan arg} {
  17. global black
  18. if {![validchan $chan]} { return }
  19. set handle [nick2hand $nick]
  20. if {![botisop $chan] && ![setting:get $chan xonly]} { return }
  21. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  22. if {[isbotnick $nick]} { return }
  23. set bl_protect [blacktools:protect $nick $chan]
  24. if {$bl_protect == "1"} { return }
  25. set getset [setting:get $chan chanflood]
  26. if {$getset == ""} { set getset "$black(antichanfloodrepeats)" }
  27. set number [scan $getset %\[^:\]]
  28. set time [scan $getset %*\[^:\]:%s]
  29. if {![info exists black(repeat:$host:$chan:flood)]} {
  30. set black(repeat:$host:$chan:flood) 0
  31. }
  32. foreach tmr [utimers] {
  33. if {[string match "*chanflood:unset $host $chan*" [join [lindex $tmr 1]]]} {
  34. killutimer [lindex $tmr 2]
  35. }
  36. }
  37. incr black(repeat:$host:$chan:flood)
  38. utimer $time [list chanflood:unset $host $chan]
  39. if {$black(repeat:$host:$chan:flood) >= $number} {
  40. blacktools:banner:1 $nick "ANTICHANFLOOD" $chan $host [get:banmethod "antichanflood" $chan] [link:chan:get $chan]
  41. chanflood:unset $host $chan
  42. return 1
  43. }
  44. }
  45. proc chanflood:unset {host chan} {
  46. global black
  47. if {[info exists black(repeat:$host:$chan:flood)]} {
  48. unset black(repeat:$host:$chan:flood)
  49. }
  50. }
  51. ##############
  52. #########################################################################
  53. ## END ##
  54. #########################################################################