Advertisement
Guest User

Untitled

a guest
Jun 14th, 2017
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 9.00 KB | None | 0 0
  1. ###############################
  2. # HOW TO ENABLE CHANNEL CYCLE #
  3. ###############################
  4. 3## To enable bot to cycle channel after specific time DCC to the botand give the command below
  5. # COMMAND  : .chanset #your_chan +advertisecycle  (TO ENABLE)
  6. # COMMAND  : .chanset #your_chan -advertisecycle  (TO DISABLE)
  7. ## The channel cycling wont work untill you will not enable it
  8.  
  9. ######################################################
  10. # HOW TO ENABLE BOT TO MSG AT CHANNEL TO DETECT SPAM #
  11. ######################################################
  12. ## To enable bot to msg channel after specific time DCC to the bot and #give the command below
  13. # COMMAND  : .chanset #your_chan +msgchan  (TO ENABLE)
  14. # COMMAND  : .chanset #your_chan -msgchan  (TO DISABLE)
  15. ## The channel messaging wont work untill you will not enable it
  16.  
  17.  
  18. #########################
  19. # CONFIGURATION SECTION #
  20. #########################
  21.  
  22. ## Set the channels here on which you want this script to work
  23. # Seperate channels by Space like "#channel1 #channel2 #channel3"
  24. # If you want this script to work on all the channels where ur bot is #parked leave it as ""
  25.  
  26. set advertisechans "#states"
  27.  
  28. ##Set Advertising words here on which you want your bot to kick user
  29. #You can manually add advertising words in the way mentioned below ( #*WILD CARDS SUPPORTED* )
  30. # set advertisingword {
  31. # "*word1*"
  32. # "*word2*"
  33. # }
  34.  
  35. set advertisingword {
  36.   "*#*"
  37.   "*.com"
  38.   "*.net"
  39. "*.org"
  40.  
  41. }
  42.  
  43. #Set how many times you want the bot to warn the user advertising #before baning him out of channel
  44. ## To Disable set it to 0
  45. #Set it to 0 if you want to ban the user without giving warning.
  46. set uwarn 0
  47.  
  48. #set the Warning MSG you want bot to deliver
  49. #It will not work if the above setting is set to zero
  50.  
  51. set warnmsg "Spammer. i made a mistake? /msg jose or /msg mod"
  52.  
  53. #Set time Below after which you want your bot to cycle the channel (in #Minutes)
  54. #After this time bot will cycle the channel and will detect #advertisements if found will kick out
  55. set advcycletime "15"
  56.  
  57. #Set the time after which you want to msg the channel for which you #enabled +msgchan
  58. #After this time bot will msg that channel to detect spam
  59. set spammsg "25"
  60.  
  61. #Set the Msg you want bot to post to the channel [Would work only if #enabled through partylines]
  62.  
  63. set mspam "Checking por spams.."
  64.  
  65. #Set the message below you want to give while bot parting channel
  66. set partspam "spams? brb.. checking.."
  67.  
  68. # Set the banmask type to use in banning the User who Advertises.
  69. # Currently BAN Type is set to 1 (*!*@some.domain.com),
  70. # BAN Types are given below;
  71. # 1 - *!*@some.domain.com
  72. # 2 - *!*@*.domain.com
  73. # 3 - *!*ident@some.domain.com
  74. # 4 - *!*ident@*.domain.com
  75. # 5 - *!*ident*@some.domain.com
  76. # 6 - *nick*!*@*.domain.com
  77. # 7 - *nick*!*@some.domain.com
  78. # 8 - nick!ident@some.domain.com
  79. # 9 - nick!ident@*.host.com
  80. set advbantype "1"
  81.  
  82. #Set the Users Mode you want to Exempt
  83. #The Bot will not kick the user who had the modes you will define below
  84. #You can leave it as it is , if you dont know about it
  85. #Recommended : of
  86. set advusers "of"
  87.  
  88. ###################
  89. # SET KICK REASON #
  90. ###################
  91.  
  92. ## Set Kick Reason for spam on channel or Advertise on channel
  93. # The user will be kicked using this reason when someone advertise / #Spam on the main of channel
  94. set advertisekick "Spam Kick - For further help join #StatesHelp"
  95.  
  96. ## Set the kick Reason for DCC spam
  97. # After cycling or if bot detects someone sending file to it the bot #will kick the user using this reason
  98. set dccspamkick "DCC spam Detected - For Help join #StatesHelp"
  99.  
  100. ## Set kick reason for Private Spam
  101. # The user will be kicked using this reason when someone advertise / #spam in the private of bot
  102. set pvtspamkick "Pvt Spam detected - For help join #StatesHelp"
  103.  
  104.  
  105. # ALL THE BINDS #
  106.  
  107. setudef flag advertisecycle
  108. setudef flag msgchan
  109. bind msgm - * privatespam:RanaUsman
  110. bind ctcp - DCC RanaUsman:dcc
  111. bind pubm - * advertising:RanaUsman
  112. bind EVNT - init-server pStartTimer
  113. bind EVNT - init-server pmsgchan
  114.  
  115. # ALL THE PROCEDURES #
  116. #This proc is to detect channel advertisements
  117. proc advertising:RanaUsman {nick uhost hand chan text} {
  118. global advertisingword advertisechans advertisekick banmask advusers adver warnmsg uwarn
  119. #This checks for enabled channels for advertisescript
  120. if {(([lsearch -exact [string tolower $advertisechans] [string tolower $chan]] != -1)  || ($advertisechans == ""))} {
  121. set text [advertise:filter $text]
  122. set banmask "[advs:banmask $uhost $nick]"
  123. #this detects if there is some advertising word found :-)
  124. foreach advertising [string tolower $advertisingword] {
  125. if {[string match -nocase $advertising $text] || [string match -nocase "* $advertising *" $text] || [string match -nocase "$advertising *" $text] || [string match -nocase "* $advertising" $text]} {
  126. if {[matchattr $hand $advusers] || [isbotnick $nick]} { return 0 } else {
  127. # doing counter
  128. if { ![info exists adver($uhost)] } {
  129.          set adver($uhost) "0"
  130.          } else {
  131.          incr adver($uhost)
  132.          }
  133.          if { $adver($uhost) < $uwarn } {
  134.          putserv "privmsg $chan :\002$nick\002 : $warnmsg"
  135.          return
  136.          }
  137. putquick "MODE $chan +bb $banmask"
  138. putquick "KICK $chan $nick :$advertisekick"
  139.     }
  140.    }
  141.   }
  142.  }
  143. }
  144. # this proc will detect for pvt spam
  145. proc privatespam:RanaUsman {nick uhost hand text} {
  146. global spampvt advertisingword advertisechans pvtspamkick banmask advusers
  147. set text [advertise:filter $text]
  148. set banmask "[advs:banmask $uhost $nick]"
  149. foreach advertising [string tolower $advertisingword] {
  150. if {[string match -nocase $advertising $text] || [string match -nocase "* $advertising *" $text] || [string match -nocase "$advertising *" $text] || [string match -nocase "* $advertising" $text]} {
  151. #below is the action bot will take against spammer and detects it if he is in channel
  152. foreach onchans [channels] {
  153. if {[onchan $nick $onchans]} {
  154. if {[matchattr $hand $advusers] || [isbotnick $nick]} { return 0 } else {
  155. utimer 2 [list putquick "MODE $onchans +bb $banmask"]
  156. utimer 3 [list putquick "KICK $onchans $nick :$pvtspamkick"]
  157.      }
  158.     }
  159.    }
  160.   }
  161.  }
  162. }
  163. # This proc will check for DCC spam
  164.  
  165. proc RanaUsman:dcc {nick uhost handle dest key arg} {
  166.  global dccspamkick rusman onechans banmask advertisechans advusers dccspamword
  167.  set banmask "[advs:banmask $uhost $nick]"
  168.  set rusman [string tolower [lindex $arg 1]]
  169.  if {[string match "*.exe" $rusman] || [string match "*.bat" $rusman] || [string match "*.vbs" $rusman] || [string match "*.html" $rusman] || [string match "*.htm" $rusman] || [string match "*.com" $rusman] || [string match "*.net" $rusman] || [string match "*.org" $rusman] || [string match "*.ini" $rusman] || [string match "*.zip" $rusman] || [string match "*.rar" $rusman]} {
  170.  foreach onchans [channels] {
  171.  if {[onchan $nick $onchans]} {
  172.  if {[matchattr $handle $advusers] || [isbotnick $nick]} { return 0 } else {
  173.  utimer 2 [list putquick "MODE $onchans +bb $banmask"]
  174.  utimer 3 [list putquick "KICK $onchans $nick :$dccspamkick"]
  175.     }
  176.    }
  177.   }
  178.  }
  179. }
  180.  
  181.  
  182.  
  183. proc pStartTimer {type} {
  184.   pScheduleTimer
  185. }
  186.  
  187. proc pScheduleTimer {} {
  188.   global advcycletime
  189.   foreach item [timers] {
  190.     if {[string equal "RanaUsman:cycle" [lindex $item 1]]} {
  191.       killtimer [lindex $item 2]
  192.     }
  193.   }
  194.   timer $advcycletime RanaUsman:cycle
  195. }
  196.  
  197. proc RanaUsman:cycle {} {
  198.   global advcycletime
  199.   global partspam
  200.   foreach chan [channels] {
  201.     if {[channel get $chan advertisecycle]} {
  202.       putserv "PART $chan :$partspam"
  203.     }  
  204.   }
  205.   pScheduleTimer
  206. }
  207.  
  208. #It will msg channel after every 15 mins to detect spam
  209.  
  210. proc pmsgchan {type} {
  211.   pmsgtimer
  212. }
  213.  
  214. proc pmsgtimer {} {
  215.   global spammsg
  216.   foreach item [timers] {
  217.     if {[string equal "RanaUsman:checkspam" [lindex $item 1]]} {
  218.       killtimer [lindex $item 2]
  219.     }
  220.   }
  221.   timer $spammsg RanaUsman:checkspam
  222. }
  223.  
  224. proc RanaUsman:checkspam {} {
  225.   global advcycletime
  226.   global partspam mspam
  227.   foreach chan [channels] {
  228.     if {[channel get $chan msgchan]} {
  229.       putserv "PRIVMSG $chan :$mspam"
  230.     }  
  231.   }
  232.   pmsgtimer
  233. }
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240. proc advertise:filter {str} {
  241.   regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  242.   return $str
  243. }
  244. # Different types of BAN for bot to do :-)
  245.  
  246. proc advs:banmask {uhost nick} {
  247.  global advbantype
  248.   switch -- $advbantype {
  249.    1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
  250.    2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
  251.    3 { set banmask "*!*$uhost" }
  252.    4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
  253.    5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
  254.    6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
  255.    7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
  256.    8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
  257.    9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
  258.    default { set banmask "*!*@[lindex [split $uhost @] 1]" }
  259.    return $banmask
  260.   }
  261. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement