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)
}
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.
@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.
}
}
}
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.
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
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.
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!
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
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.
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.
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?