BT.antipub.tcl 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ########################## ANTIPUB 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 antipub:protect {nick host hand chan arg} {
  17. global black botnick
  18. set text [color:filter [split $arg]]
  19. set found_pub 0
  20. set handle [nick2hand $nick]
  21. set found_pub ""
  22. set banword ""
  23. if {![validchan $chan]} { return }
  24. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  25. set bl_protect [blacktools:protect $nick $chan]
  26. if {$bl_protect == "1"} { return }
  27. if {![botisop $chan] && ![setting:get $chan xonly]} { return }
  28. set text [check:except $text $chan $black(antipubword) $black(antipubexcept) "ANTIPUB"]
  29. set check_word [check:file:word $chan $text "ANTIPUB"]
  30. if {$check_word != ""} {
  31. blacktools:banner:1 $nick "ANTIPUB:$check_word" $chan $host [get:banmethod "antipub" $chan] [link:chan:get $chan]
  32. return 1
  33. }
  34. }
  35. proc check:except {text chan type except prot} {
  36. global black
  37. set text [split $text]
  38. set counter_word 0
  39. set counter_except 0
  40. set found_it 0
  41. foreach ex $except {
  42. set position [lsearch -exact [string tolower $text] [string tolower $ex]]
  43. if {$position > -1} {
  44. set text [lreplace $text $position $position]
  45. }
  46. }
  47. set file [open $black(add_file) r]
  48. set size [file size $black(add_file)]
  49. set data [split [read $file $size] \n]
  50. close $file
  51. foreach line $data {
  52. if {$line != ""} {
  53. set channel [lindex [split $line] 0]
  54. set getype [lindex [split $line] 1]
  55. set link [join [lrange [split $line] 3 end]]
  56. foreach word $text {
  57. if {[string equal -nocase $channel $chan] && [string equal -nocase $getype $prot] && [regexp {^[+]} $link] && [string match -nocase [string map {"+" ""} $link] $word]} {
  58. set position [lsearch -exact [string tolower $text] [string tolower $word]]
  59. if {$position > -1} {
  60. set text [lreplace $text $position $position]
  61. }
  62. }
  63. }
  64. }
  65. }
  66. return $text
  67. }
  68. proc antipub:module {nick host hand chan arg} {
  69. global black lastbind
  70. set type 0
  71. set chan1 "$chan"
  72. set why [lindex [split $arg] 0]
  73. set except [join [lrange [split $arg] 1 end]]
  74. set number [lindex [split $arg] 1]
  75. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  76. set chan "$why"
  77. set why [lindex [split $arg] 1]
  78. set except [join [lrange [split $arg] 2 end]]
  79. set number [lindex [split $arg] 2]
  80. }
  81. set return [blacktools:mychar $lastbind $hand]
  82. if {$return == "0"} {
  83. return
  84. }
  85. prot:module:process $nick $host $hand $chan $chan1 $why $except $type $number "antipub"
  86. }
  87. ##############
  88. #########################################################################
  89. ## END ##
  90. #########################################################################