Website Blocker [ updated]

By reider45 on May 27, 2011

Here is an effective url blocker so when someone posts a link into you're chat, it will kick them [Obviously bot must be a mod]

on @*:text:*:#:{
  if ( $nick isop $chan ) {halt}
  var %b 1, %c *www.* *http://* *.com* *.net* *.tk* *.us* *.co* *.gov* *.org*
  while $gettok(%c,%b,32) {
    if $wildtok($1-,$v1,0,32) {
      ban -ku30 # $nick 2 You've been kicked for posting a link.
    }
    inc %b
  }
}

Comments

Sign in to comment.
rinzes   -  Feb 11, 2013

I would like to add to this script 'msg $chan DON'T click on that link' how and were would you place that line.

Conscious  -  Feb 12, 2013

Under the ban -ku30 line.

rinzes  -  Feb 12, 2013

I did that and it gets posted to the room 4 times?

Conscious  -  Feb 13, 2013

after it add the line 'break'

rinzes  -  Feb 13, 2013

so like this:

ban -ku30 # $nick 2 You've been kicked for posting a link.
msg $chan Don't Click On That Link

break
}

Conscious  -  Feb 14, 2013

Yes.

Sign in to comment

Epic   -  May 29, 2011

jaytea's post made my turn my head at the computer screen going .-.

 Respond  
Ahmed Zaggoudi   -  May 29, 2011

Ohh, I did not know that before
Thank you Burrito & Jethro_

 Respond  
Jethro   -  May 29, 2011

jaytea, how about getting the point out in the open? You always have a tendency to explain a subject with jargon and roundabout wording. I'm not attempting to offend your intelligence or anything. Don't steer me wrong. You're one of the brightest MSL scripters, but please bear in mind that not every Hawkee member uses English as his or her first language. Let's not make the explanation harder than it already has been.

 Respond  
jaytea   -  May 29, 2011

How does that work?

it doesn't.

appending one line of code to another uses 3 bytes in the average case, ('command1 | command2') and 1 byte in the case where the command follows a brace ('{ command'), or indeed a brace follows a command.

splitting a line of code over multiple lines always uses at least 2 bytes (CRLF) + 2 spaces of indentation for every new level of brace depth, generally totaling >= 4b.

it should go without saying that this does not mean you should avoid using new lines ;)

 Respond  
Conscious   -  May 28, 2011

Conscious, making it one line doesn't actually reduce the byte size but increase it...
How does that work?

 Respond  
Jethro   -  May 28, 2011

With iswm, you need to $strip($1-) or tokenize 32 $strip($1-) under the text event ; with isin, you don't have to.

It's ideal to use the $strip() if you don't set your mIRC to strip incoming messages. The control codes usually result in triggers not being recognized.

 Respond  
napa182   -  May 28, 2011

AmytiX also along with the iswm or isin use $1- cuz using $1 only does it if it's the first thing said.

 Respond  
Jethro   -  May 28, 2011

AmytiX, $vnick and $opnick can only be used in conjunction with the voice and op event. You can't use them under a text event and expect them to be excluded.

You should either use:

if ($nick isop $chan) { halt }
if ($nick isvoice $chan) { halt }

Or:

if ($nick($chan,@%)) {

Or:

if ($nick($chan,oh)) {

You should use the iswm operator like Burrito said...or isin will do it too.

 Respond  
Burrito   -  May 28, 2011

AmytiX: using the == means it must be *.com or whatever is there. You should use something like iswm.

 Respond  
Ahmed Zaggoudi   -  May 28, 2011

Hmm Nice ;)
Why you don't add somthing to don't kick ops and voices people . You can use also this :

on *:text:*:#:{
  if ($opnick == $nick) { halt }
  if ($vnick == $nick) { halt }
  if ($me isop $chan) {
    if ($1 == *www*) { kick $chan $nick has been kicked }
    if ($1 == *http://*) { kick $chan $nick has been kicked }
    if ($1 == *.com) { kick $chan $nick has been kicked }
    if ($1 == *.net) { kick $chan $nick has been kicked }
  }
}

This is very simple Snippet, But I like very much snippet of Jethro_ & Wader ;)

 Respond  
Wader   -  May 28, 2011

looking at some regex or as its proper name Regular Expressions will really help scripting in many languages as its pretty much a language on its own and is used in many different areas including php, .net, java, msl, etc.

http://gnosis.cx/publish/programming/regular_expressions.html

 Respond  
reider45   -  May 28, 2011

im just going to stick to my knowlege of mIRC scripting but when i learn more advanced things my snippets will be better... do u have any links for scripting tutorials (advanced)

 Respond  
Jethro   -  May 28, 2011

reider45, you can use $count() like this:

on @*:text:*:#:{ 
  if ($count($strip($1-),www.,http://,.com,.net,.tk,.us,.co,.gov,.org)) {
    kick # $nick No URL!
  }
}
 Respond  
Jethro   -  May 28, 2011

Conscious, making it one line doesn't actually reduce the byte size but increase it...
Wader, the /g modifier can be dropped. It's not necessary though.

 Respond  
reider45   -  May 28, 2011

Jethro_ i understand what ur saying but i use jtv so when it kicks someone they cant talk for 10-min so it works for me :D

 Respond  
reider45   -  May 28, 2011

Hey guys chill it may be long and messy but it does work.

 Respond  
v9xx   -  May 28, 2011

Hey guys thanks for the fixes. very long time ago, didn't know regex

 Respond  
Wader   -  May 28, 2011

cause that looks messy, hate it when people use stuff as such

alias blah code here

also confuses alot of people as they may not be familiar with non-standard formatting.

 Respond  
Conscious   -  May 28, 2011

If you want it small, Wader, why not keep it to one line?

 Respond  
Wader   -  May 28, 2011
on $@:TEXT:/(www\.|http(s)?\x3A\x2F\x2F)([^\s]+)(\.(uk|co(m)?|tk|net|us|gov|org))?/giS:#: { 
  ban -ku30 # $nick Please do not post links here.
}

Should help to keep it even smaller.

 Respond  
Jethro   -  May 28, 2011

Chances are they'll keep on coming back after being kicked.

I believe regex will work best for detecting a URL with one line, but if you don't know regex, you can do it with $wildtok and a loop like this:

on @*:text:*:#:{ 
  var %b 1, %c *www.* *http://* *.com* *.net* *.tk* *.us* *.co* *.gov* *.org*
  while $gettok(%c,%b,32) { 
    if $wildtok($1-,$v1,0,32) {
      ban -ku30 # $nick 2 You've been kicked for posting a link.
    }
    inc %b
  }
}

This will ban them for 30 seconds and kick the offender.

Your approach of using one text event per routine is rather repetitive, and the remote size will get a lot bigger than you think when you decide to add more over time.

rinzes  -  Feb 11, 2013

I tried to modify the script to add 'msg $chan DON'T CLICK THAT LINK' however it gets posted 4 times. Any suggestions

Sign in to comment

Epic   -  May 27, 2011

._.

 Respond  
napa182   -  May 27, 2011

lol

 Respond  
Conscious   -  May 27, 2011

Change the "kick $chan $nick has been kicked"s to exit -n

 Respond  
napa182   -  May 27, 2011

lolwut .... =/

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.