Coders-IRC


IRC for Coders

Simple One Man Spam Prevention Bot


image

on @*:TEXT:*:#*:{ noop $flood_counter $repeat_counter($1-)   }
on @*:ACTION:*:#*:{ noop $flood_counter $repeat_counter($1-) }
on *:NICK:{
  var %table flood , %timeframe 300 , %wilditem $+(*!,$fulladdress)
  while ($hfind(%table,%wilditem,1,w)) {
    hdel %table $v1
    hadd -u $+ %timeframe %table $puttok($v1,$newnick,3,33)
  }

  var %timeframe2 300 , %table1 repeat.text , %table2 repeat.count , %wilditem $+(*!,$fulladdress)
  while ($hfind(%table1,%wilditem,1,w)) {
    var %a $puttok($v1,$newnick,2,33)
    hadd -u $+ %timeframe2 %table1 %a $hget(%table1,$v1)
    hadd -u $+ %timeframe2 %table2 %a $hget(%table2,$v1)
    hdel %table1 $v1
    hdel %table2 $v1
  }

}

alias -l repeat_counter {
  var %timeframe2 300 , %kill.at.repeats 3 , %table1 repeat.text , %table2 repeat.count
  var %text $lower($strip($1))

  if (!$hget(%table1)) { hmake %table1 101 }
  if (!$hget(%table2)) { hmake %table2 101 }
  var %item $+($chan,!,$fulladdress)
  var %a $hget(%table1,%item)
  if ((%a == $null) || (%a != %text)) {
    hadd -u $+ %timeframe2 %table1 %item %text
    hadd -u $+ %timeframe2 %table2 %item 1
    return
  }

  var %secs $hget(%table1,%item).unset | if (!%secs) var %secs %timeframe2
  hinc -u $+ %timeframe2 %table2 %item
  var %count $hget(%table2,%item)

  if (%count >= %kill.at.repeats) {
    echo 4 -a $nick has repeated %count times within %timeframe2 seconds. Action goes in here
  }

}

alias -l flood_counter {
  var %timeframe 300 , %max.messages 5 , %table flood
  if (!$hget(%table)) { hmake %table 101 | hadd %table counter 1 }
  var %counter $hget(%table,counter) | hinc %table counter 1
  var %item $+(%counter,!,$chan,!,$fulladdress) , %wilditem $+(*!,$chan,!,$fulladdress)
  hadd -u $+ %timeframe %table %item | var %msg_count $hfind(%table,%wilditem,0,w)
  echo -s debug message: $nick has %msg_count messages in the last %timeframe seconds
  if (%msg_count >= %max.messages) {
    echo 4 -s action to take against $nick in $chan goes inside these brackets
  }
}



Expand


Read More

Channel Closure Script


image

; Oper Tools for TheArkNet
; by Raccoon 2019

; This script assumes that opers are not subject to excess flood disconnect.
; You can access this tool from menu by right-clicking the channel chat area.
; Actions are logged to operclosechan.log
; Example: /operclosechan #badchan You guys are misbehaving!

; /OperCloseChan <#channel_name> <reason_required>
ALIAS OperCloseChan {
  var %chan = $1, %reason = $2-
  if (!%chan) { echo -atic notice * Usage: /OperCloseChan #channel_name This channel is closed due to violation. | return }
  if (!%reason) { echo 4 -ati * OperCloseChan: You MUST specify a reason for closing the channel! | return }
  if ($left(%chan,1) !isin $chantypes) { echo 4 -ati * OperCloseChan: %chan is an invalid channel name! | return }
  if ($me !ison %chan) {
    set -eu10 %_operclosechan. $+ %chan %reason
    !JOIN %chan
    return
  }
  ; -----
  
  MSG %chan This channel has been determined to be in violation of the terms of service for this network and is being closed. $&
    If you have any questions please join #Help and speak to an IRCop.  (Reason: %reason $+ )
  CS CLEAR %chan USERS
  CS CLEAR %chan BANS
  CS DROP %chan %chan
  MODE %chan +muski $regsubex(randomstring,$str(x,10),/x/g,$r(a,z))
  PART %chan
  echo -stic info * OperCloseChan: Closed channel %chan for %reason
  write operclosechan.log $asctime %chan %reason
  
} ; by Raccoon 2019


; End of /NAMES (you joined a channel)
RAW 366:*: {
  var %chan = $2
  if ($($+(%,_operclosechan.,%chan),2)) {
    unset $+(%,_operclosechan.,%chan)
    OperCloseChan %chan $v1
  }
  ; ...
} ; by Raccoon 2019


MENU Channel {
  -
  Oper Tools
  .Close Channel: {
    OperCloseChan $&
      $$input(Enter channel to permanently close.,ews,$active,Oper Tools: Close Channel,$active) $&
      $$input(Enter reason for closing the channel.,ews,$active,Oper Tools: Close Channel)
  }
  ;...
}
; by Raccoon 2019

Expand


Read More