BT.antibadword.tcl 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ######################## ANTIBADWORD 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 antibadword:protect {nick host hand chan arg} {
  17. global black botnick username
  18. if {![validchan $chan]} { return }
  19. set handle [nick2hand $nick]
  20. set found_word ""
  21. set text [color:filter [split $arg]]
  22. set split_check ""
  23. set get_pers ""
  24. if {![validchan $chan]} { return }
  25. if {![botisop $chan] && ![setting:get $chan xonly]} { return }
  26. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  27. set bl_protect [blacktools:protect $nick $chan]
  28. if {$bl_protect == "1"} { return }
  29. if {[isbotnick $nick]} { return }
  30. set text [check:except $text $chan $black(antibadword) $black(except_badwords) "BADWORD"]
  31. set check_word [check:file:word $chan $text "BADWORD"]
  32. if {$check_word != ""} {
  33. if {[regexp {[:]} $check_word]} {
  34. set split_check [split $check_word ":"]
  35. set check_word [join [lindex $split_check 0]]
  36. set get_pers [lindex $split_check 1]
  37. }
  38. if {$get_pers != ""} {
  39. blacktools:banner:1 $nick "ANTIBADWORD:$check_word" $chan $host [get:banmethod "antibadword:$get_pers" $chan] [link:chan:get $chan]
  40. } else {
  41. blacktools:banner:1 $nick "ANTIBADWORD:$check_word" $chan $host [get:banmethod "antibadword" $chan] [link:chan:get $chan]
  42. }
  43. return 1
  44. }
  45. }
  46. proc badword:module {nick host hand chan arg} {
  47. global black lastbind
  48. set type 0
  49. set chan1 "$chan"
  50. set why [lindex [split $arg] 0]
  51. set badw [join [lrange [split $arg] 1 end]]
  52. set number [lindex [split $arg] 1]
  53. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  54. set chan "$why"
  55. set why [lindex [split $arg] 1]
  56. set badw [join [lrange [split $arg] 2 end]]
  57. set number [lindex [split $arg] 2]
  58. }
  59. set return [blacktools:mychar $lastbind $hand]
  60. if {$return == "0"} {
  61. return
  62. }
  63. prot:module:process $nick $host $hand $chan $chan1 $why $badw $type $number "badword"
  64. }
  65. ##############
  66. #########################################################################
  67. ## END ##
  68. #########################################################################