mIRC Home    About    Download    Register    News    Help

Topic Options
#259938 - 13/02/17 03:10 PM spam protection help
x3pos Online
Babel fish

Registered: 17/01/16
Posts: 78
Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return } 
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3- 
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
  if ($nick isop $chan) { return }
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) { 
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }

  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}


This works but it does not work when the moderator writes.

Code:
viewer:1
viewer:2
viewer:3
bot:viewer you are spamming to fast. timeout!

this is working good
Code:
viewer:1
viewer:2
moderatör:hi
viewer:hello
bot:viewer you are spamming to fast. timeout!

this is wrong because writing 1 time.
code is ignoring moderators.


Edited by x3pos (13/02/17 03:14 PM)

Top
#259942 - 13/02/17 06:26 PM Re: spam protection help [Re: x3pos]
Blas Offline
Babel fish

Registered: 27/10/15
Posts: 76
I think you're wanting the "%spamlines" and "%spamnick" to restart to 0 when a mod says a message in channel. I would get rid of the "if ($nick isop $chan) { return }" line and add a check to see if the user who typed the message is a mod before adding their name to the %spamnick and adding to the %spamlines. If they are a mod, then erase/unset the %spamlines and %spamnick.

Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3-
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) {
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }
  }
  elseif ($nick isop $chan) {
    unset %spamnick
    unset %spamlines
  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}
_________________________
My Twitch mIRC Bot Games and Stuff

Top
#259963 - 14/02/17 06:01 PM Re: spam protection help [Re: x3pos]
x3pos Online
Babel fish

Registered: 17/01/16
Posts: 78
Sorry did not work this code.

Top
#259975 - 15/02/17 08:32 PM Re: spam protection help [Re: x3pos]
Blas Offline
Babel fish

Registered: 27/10/15
Posts: 76
I'm not sure what you were asking then. smirk
_________________________
My Twitch mIRC Bot Games and Stuff

Top
#259980 - 16/02/17 05:57 PM Re: spam protection help [Re: x3pos]
x3pos Online
Babel fish

Registered: 17/01/16
Posts: 78
No you understand what I ask but the code did not work

Top
#259985 - 16/02/17 11:33 PM Re: spam protection help [Re: x3pos]
Fonic_Artes Offline
Babel fish

Registered: 08/06/15
Posts: 84
Lemme see if I can understand.

Do you want it to time out moderators for spamming, or just regular viewers?

Top
#259987 - 17/02/17 02:51 AM Re: spam protection help [Re: x3pos]
x3pos Online
Babel fish

Registered: 17/01/16
Posts: 78
This code works exactly as I want it to, but the problem is this.
Let's say I made the bottom line writing limit 3.(!timeout line 3)
No problem running command good.
But when the moderators write the text between the bottom line and the bottom line, the code does not see what I wrote and the viewer is timeout. I want the code to be edited. When moderators write, I want the counter to be zero.
example,
Code:
viewer1=1
viewer1=2
viewer1=3
bot=viewer1 timeout! you are spamming!

Code:
viewer1=1
viewer1=2
moderator1=hello
moderator2=hi
viewer1=hello
bot=viewer1 timeout! you are spamming!

another example,
Code:
viewer1=1
moderator1=good morning
viewer1=2
@moderatornighbot=bla bla bla...
viewer1=3
bot=viewer1 timeout! you are spamming!

this code ignoring moderator texts. i dont want timeout viewers when moderators writing please fix this script
Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return } 
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3- 
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
  if ($nick isop $chan) { return }
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) { 
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }

  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}


Edited by x3pos (17/02/17 02:53 AM)

Top
#259997 - 17/02/17 05:33 PM Re: spam protection help [Re: x3pos]
Fonic_Artes Offline
Babel fish

Registered: 08/06/15
Posts: 84
Hmm, maybe something like this?

Code:
on *:text:*:#: {
  if ($nick isop $chan) { %spamlines = 1 }
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) { 
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }

  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}


This being inside the last half of the code, and I won't say it will work since I haven't tested it.

The basic idea though is you check if they're a moderator and if they are, reset %spamlines back to 1 or just unset %spamlines.

Top
#260003 - 18/02/17 12:24 AM Re: spam protection help [Re: x3pos]
Blas Offline
Babel fish

Registered: 27/10/15
Posts: 76
The code that I had originally supplied has been tested and it does work for me. I will add comments in the code to help explain it.

Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3-
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
; 1) The first IF statement checks to see if the user is the last user to type anything in chat.
; If they are the last user to type anything, then the code will increase their amount of
; spamlines by 1. If this number reaches 3 (%spamlines), then this will time the user out.
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) {
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }
  }
; 2) If the last user to type anything in chat is a MOD, this will UNSET (delete) the name of the
; last user to type anything in chat (%spamnick) as well as the number of %spamlines.
; Also, because this code happens BEFORE the next 'else' statement, a MOD can NEVER be the user
; that sets the %spamnick and %spamlines. Therefor, a MOD typing anything in chat will ALWAYS
; reset the %spamnick and %spamlines variables back to 0 by UNSETing them.
  elseif ($nick isop $chan) {
    unset %spamnick
    unset %spamlines
  }
; 3) If a user is NOT a mod (because of above 'elseif' statement) and is NOT the last person to
; trigger the spam protection (because of first 'if' statement), then this statement will set
; that user as the current %spamnick variable and set the %spamlines to 1.
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}
_________________________
My Twitch mIRC Bot Games and Stuff

Top
#260034 - 20/02/17 09:16 PM Re: spam protection help [Re: Blas]
x3pos Online
Babel fish

Registered: 17/01/16
Posts: 78
its working thank you!

Top
#260085 - 26/02/17 03:31 PM Re: spam protection help [Re: x3pos]
x3pos Online
Babel fish

Registered: 17/01/16
Posts: 78
/me messages dont work help me please smile
Code:
viewer=1
viewer=2
viewer=3
bot=you are spamming

its work no problem but....
Code:
viewer=/me 1
viewer=/me 2
viewer=/me 3


Edited by x3pos (26/02/17 06:38 PM)

Top
#260087 - 27/02/17 02:30 AM Re: spam protection help [Re: x3pos]
Blas Offline
Babel fish

Registered: 27/10/15
Posts: 76
Sneaky viewers. :P

Tested and working. I put the spamcheck in an alias and made the alias run whenever someone in chat posts a message or does a /me (action).

Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3-
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: spamcheck $chan
on *:action:*:#: spamcheck $chan

alias spamcheck {
  if ($nick isop $1) {
    unset %spamnick
    unset %spamlines
  }
  elseif ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) {
      msg $1 .timeout $nick %spamtime %spammessage
      msg $1 $nick you're spamming too fast. slow down!
      %spamlines = 1
    }
  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}
_________________________
My Twitch mIRC Bot Games and Stuff

Top
#260089 - 27/02/17 06:16 PM Re: spam protection help [Re: Blas]
x3pos Online
Babel fish

Registered: 17/01/16
Posts: 78
sorry tested but doesnt work

Top