BT.antibadtext.tcl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ######################## ANTIBADTEXT 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. ############################# AntiColor ################################
  17. proc colortext:process {nick host hand chan arg type} {
  18. global black
  19. if {![validchan $chan]} { return }
  20. set handle [nick2hand $nick]
  21. if {![botisop $chan] && ![setting:get $chan xonly]} { return }
  22. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  23. if {[isbotnick $nick]} { return }
  24. set bl_protect [blacktools:protect $nick $chan]
  25. if {$bl_protect == "1"} { return }
  26. switch $type {
  27. anticolor {
  28. set textfind "\003"
  29. }
  30. antibold {
  31. set textfind "\002"
  32. }
  33. antiunderline {
  34. set textfind "\037"
  35. }
  36. }
  37. if {$type == "anticolor" && $black(anticolor:specific_colors) != ""} {
  38. foreach c $black(anticolor:specific_colors) {
  39. if {[string match "*$c*" $arg]} {
  40. blacktools:banner:1 $nick [string toupper "$type"] $chan $host [get:banmethod $type $chan] [link:chan:get $chan]
  41. break
  42. }
  43. }
  44. return
  45. }
  46. if {[string match "*$textfind*" $arg]} {
  47. blacktools:banner:1 $nick [string toupper "$type"] $chan $host [get:banmethod $type $chan] [link:chan:get $chan]
  48. return 1
  49. }
  50. }
  51. proc anticolor:protect {nick host hand chan arg} {
  52. colortext:process $nick $host $hand $chan $arg "anticolor"
  53. }
  54. ############################# AntiBold ################################
  55. proc antibold:protect {nick host hand chan arg} {
  56. colortext:process $nick $host $hand $chan $arg "antibold"
  57. }
  58. ############################ AntiUnderline ###############################
  59. proc antiunderline:protect {nick host hand chan arg} {
  60. colortext:process $nick $host $hand $chan $arg "antiunderline"
  61. }
  62. ############################## AntiCaps #################################
  63. proc anticaps:protect {nick host hand chan arg} {
  64. global black botnick
  65. set handle [nick2hand $nick]
  66. set found_caps 0
  67. set argz [split $arg]
  68. if {![validchan $chan]} { return }
  69. if {![botisop $chan] && ![setting:get $chan xonly]} { return }
  70. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  71. set bl_protect [blacktools:protect $nick $chan]
  72. if {$bl_protect == "1"} { return }
  73. if {[isbotnick $nick]} { return }
  74. set caps($nick:$host) 0
  75. foreach a [split $arg] {
  76. if {[onchan $a $chan]} {
  77. set search [lsearch -exact $argz $a]
  78. set argz [lreplace $argz $search $search]
  79. }
  80. }
  81. foreach word [split $argz {}] {
  82. if [string match \[A-Z\] $word] {
  83. incr caps($nick:$host)
  84. }
  85. }
  86. if {$caps($nick:$host) == 0} {
  87. return
  88. }
  89. if {[string length $argz] < 20} {return}
  90. set capchar [string length $argz]
  91. if {[expr 100 * $caps($nick:$host) / $capchar] > $black(anticapscount)} {
  92. set found_caps 1
  93. }
  94. if {$found_caps == "1"} {
  95. blacktools:banner:1 $nick "ANTICAPS" $chan $host [get:banmethod "anticaps" $chan] [link:chan:get $chan]
  96. return 1
  97. }
  98. }
  99. ##############
  100. #########################################################################
  101. ## END ##
  102. #########################################################################