Kick for posting link

By turbuiance on Dec 04, 2011

This is something i put together.. Im sure theres a better way of doing it, Thats why i posted here so you guys could maybe help with that .. THANKS In advance!

If its not too much trouble maybe someone could point me in the right direction as to add a option.
This is for my bot i put it on there so it would Timeout people for posting links, I would like to add a !permit username option so i can give someone permission to post links.. If not too hard to do i would also like to make it so it only permits them for a set amount of time. Also have no idea how to make it so the script checks if the person posting a link is a moderator or not..
One last question would be: how do i specify a Timeout time? This bans for 10 minutes is there a way to make it for less? say 1 second so it just deletes the link?

Thanks alot guys, I'm new to all of this learning from all of you.
Please don't be too hard on me ;)

on @$*:text:/\.(?=com|net|org|ca|uk|tv|name|ly)/iS:#:{
.kick # $nick 2 | /describe $chan Whoa! $nick $+ , Don't Post links in here without permission from a mod.. Cya in 10 mins B)
}

Comments

Sign in to comment.
amclay   -  Apr 13, 2012

Jethro, I was wondering if you could say how to kick on saying . it's filtered on jtv, and I tried taking out the "tv" and replacing it with and *** and it did not work. Thanks :)

 Respond  
turbuiance   -  Dec 07, 2011

thanks guys

 Respond  
Jethro   -  Dec 07, 2011

Though isvo still works, it's deemed deprecated. isvoice is documented in the help file. ishop is also interchangeable with ishelp

 Respond  
SReject   -  Dec 07, 2011

To Post Code: use [ code ] code here [ /code ] without the spaces within [ ]'s

You can use the following in if statements to check if the user isvoice, ishalfop, and/or isop:
if (user isvo channel) { ... }
if (user ishop channel) { ... }
if (user isop channel) { ... }

 Respond  
turbuiance   -  Dec 07, 2011

thanks S reject.. I dont really understand that too much.. a little out of my league.. this is what i came up with

on $:text:/.(?=com\b|net\b|org\b|ca\b|uk\b|tv\b|name\b|ly\b)/iS:#:{
if (%links == 1) {
.kick # $nick 2 | /describe $chan Whoa! $nick $+ , Didn't you read the rules below?? Take this time to read them B)
}
}
on
:text:!Links on:#:{
%links = 1
describe $chan Links are now going to get Timeouts.
}
on *:text:!Links off:#:{
%links = 0
describe $chan Links are now Allowed.
}

seems to work for what i need.. Do you have any idea how i would add a Mod checker to my code above?
Btw, Im just learning if you couldn't tell, or i would use your code.. its a little to advanced.. want to try to make my own for the most part.. or atleast use ones that i understand instead of just copy and pasting and having to ask how to do everything... Thanks again guys.. This is a awesome forum..Everyone is so helpful

Oh yeah how do I post my Code in the boxes like you guys are? i dont see a option to do it.

 Respond  
SReject   -  Dec 07, 2011

@Jethro: I understand this, and if you take a closer look at my regex you will notice that http:// and www. are optional. I added them for speed purposes

@Turbiance, Here you go, an on/off version of my simple script:

alias LinkKick {
  if ($isid) {
    return $($+(%,LinkKick:,$chan),2)
  }
  elseif ($($+(%,LinkKick:,$chan),2)) {
    unset $+(%,LinkKick:,$chan)
  }
  else {
    set $+(%,LinkKick:,$chan) $true
  }
}

menu Channel {
  $iif($LinkKick,Disable,Enable) LinkKick:LinkKick-Toggle
}

on @*:text:*:#:{
  if ($LinkKick) {
    var %m = /(?:(?:https?:\/\/(?:www\.)?)|ftps?:\/\/|www\.)?\S+\.(?:[a-z]{2,4}|musuem)\b/iS
    if ($regex($1-,%m)) {
      ban -ku30 $chan $Nick 2 Please don't spam the channel.
    }
  }
}
 Respond  
turbuiance   -  Dec 07, 2011

Can someone Help me on how to Add A On/off to this?

 Respond  
kioken   -  Dec 05, 2011

Turbuiance, just use the kick command for JTV. It is the same thing as Timeout. You cannot specify your own time on a Timeout on JTV due to the chatserver being built from the ground up. The command is not available. I simply use, KICK #channelname $nick, and that's it.

 Respond  
turbuiance   -  Dec 04, 2011

and again the ban function isnt good.. on JTV after 2 bans JTV IP Bans the user and they aernt able to come back into the chat unless they do a IP change.. There isnt a way to do the Kick command with a changing time? Thanks guys

 Respond  
Jethro   -  Dec 04, 2011

SReject, turbuiance already stated that some people don't post links with either http:// or www. Perhaps make each portion of the match optional.

 Respond  
SReject   -  Dec 04, 2011
on @*:text:*:#:{
  var %m = /(?:(?:https?:\/\/(?:www\.)?)|ftps?:\/\/|www\.)?\S+\.(?:[a-z]{2,4}|musuem)\b/iS
  if ($regex($1-,%m)) ban -ku30 $chan $Nick 2 Please don't spam the channel.
}
 Respond  
Jethro   -  Dec 04, 2011

I edited the regex to make it more foolproof.

 Respond  
turbuiance   -  Dec 04, 2011

ok thanks!

on @$*:text:/.(?=com|net|org|ca|uk|tv|name)/iS:#:{
.kick # $nick 2 | /describe $chan Whoa! $nick $+ , Don't Post links in here without permission from a mod.. Cya in 10 mins B)
}

I had to change a few things for it to display the message in the chat. guess because its on jtv.. Any idea on what the command is for timeouts? not bans. i tried ban -k600? that still seems to ban.. problem with the ban instead of timeout is that after 2 bans even though they are unbanned 10 mins later jtv bans the users IP. the kick code above only does a Timeout i just cant figure out how to pick for how long.

 Respond  
Jethro   -  Dec 04, 2011

Then your best bet is using regex:

on $*:text:/\.(?=com\b|net\b|org\b|ca\b|uk\b|tv\b|name\b)/iS:#:{
  kick # $nick 2 Whoa! $nick $+ , Don't Post links in here without permission from a mod.. Cya in 10 mins B)
}

This will make sure a text ends with URL domain name extensions specified.

Kranium31  -  Jan 31, 2014

Im using a modified version of this and it keeps timing out regardless if links are on or off.

Can you help find the problem?

on *:text:!links on:#:{
  %links = 1
  describe $chan Links Protection On.
}
on *:text:!links off:#:{
  %links = 0
  describe $chan Links Protection Off.
}

on $*:text:/\.(?=com\b|net\b|org\b|ca\b|uk\b|tv\b|name\b|www\b|http\b)/iS:#:{
  /describe # .timeout $nick Whoa! $nick $+ , Don't Post links in here without permission from a mod.. Cya in 10 mins B)
  }
Charlatan  -  Jul 14, 2015

Example:

on @!*:text:*:#:if (%Link. [ $+ [ # ] ] = yes) { Linkick $strip($1-) }
on @!*:action:*:#:if (%Link. [ $+ [ # ] ] = yes) { Linkick $strip($1-) }

alias -l Linkick {
  var %l = $strip($1-)
  if (@ isin %l) || ($regex(#,$nick)) || ($nick(#, $nick, '.@)) halt
;if ($regex(%l,/(https?|www|irc|ftp)$+[[:punct:]])/i) || ($regex(%l,/\.(com|net)$)/i) urlkick
  if ($regex(%l,/(https?|www|irc|ftp)(\:|\.)$)/i) || ($regex(%l,/\.(com|net)$)/i) urlkick
;elseif ($regex(%l,/(grupos|groups|chats)*(msn|buzzen|legion|vsixc)$)/i) message
  elseif ($regex(%l,/(gro?upo?s|chats)?(msn|buzzen|legion|vsixc)$)/i) message
  halt
}
menu channel {
-
Protection
.$Iif(%Link. [ $+ [ # ] ] == yes, $Style(1)) Spam Protection: {
    Set %Link. [ $+ [ # ] ] $Iif(%Link. [ $+ [ # ] ] == yes, no, yes)
    Echo -at * 0Spam Protection $Iif(%Link. [ $+ [ # ] ] == yes, Activated, Desactivated)
  }
}
-

Urlkick and messages are alias you can put whatever you want in that alias.
Next of ";" theres another syntaxis you can test it because I never come back to chat.
This is from my old script modify if you want it, this code dont kick if some one put a email ex: blahblaa@email.com

Sign in to comment

turbuiance   -  Dec 04, 2011

hmm and that seems to be banning people.. its on justin dot tv.. the .kick fuction seems to be just giving Timeouts.. I dont want to ban people. also the @ doesnt seem to check if they are a mod. I'm running into this problem alot... some of the snippets on here work great on there others dont work at all or i have to change a few things for them to work.

 Respond  
turbuiance   -  Dec 04, 2011

other problem i have ran into is that some people don't put www. in alot of links.. I tried to put .com but it seems to be causing some problems.. had someone banned because the first word of their second sentence was come. they didnt put a space between the period and come and seen it as .com for some reason.. thanks again for the help, greatly appreciated!

 Respond  
turbuiance   -  Dec 04, 2011

wow thanks alot jethro and sunny... Appreciate the help.. I'm not trying to be lazy just having some trouble finding how to do certain things.. I have learned a good bit of what i know from your comments on other snippets alone lol.. any good advice for getting further on learning this? Ive basically been just rewriting others code on my own and removing/adding things to see what happens lol, probably not the easiest way of doing things

 Respond  
Jethro   -  Dec 04, 2011

Regex is a little advanced for people who've started out with MSL. You can match for http:// and www. to catch any kind of link. You can use $count(), which functions the same as the isin operator:

on @*:text:*:#:{
if ($count($strip($1-),http://,www.)) {
ban -ku600 # $nick 2 Whoa! $nick $+ , Don't Post links in here without permission from a mod.. Cya in 10 mins B)
}
}

Your kick message states that you want to see the offender in 10 minutes (600 seconds), which means you can use the /ban command and its -k and -u switch to kick and ban his or her type 2 address simultaneously. The @ by the text event is to make sure the client that runs the code is opped.

 Respond  
turbuiance   -  Dec 04, 2011

hmm so how would i put a ban for this? im really new to all of this.. havent gotten into regex yet

 Respond  
Sorasyn   -  Dec 04, 2011

isin is a poor link matching algorithm, if it works at all. The least you could do is run a regex pattern to better ensure the string posted is a link.

$regex($1-,http:\/\/\.(.*)\.(com|xxx|net|org|me|gov|tv|tk))

I'm terrible at regex so this is a first pass at something to better capture links. I'm sure someone will comment soon enough with a more refined example but may this serve as a base.

 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.