This is a very very very simple few lines of code to just ban the spam bots from twitch that post short urls followed by a sentence.
This is not 100% guaranteed to catch every one of them but over the past few days looking at there url's I think this is most of them, Just comment or add them yourself.
on *:text:*x.co*:#channelname:{
msg $chan .timeout $nick 600
}
on *:text:*bit.do*:#channelname:{
msg $chan .timeout $nick 600
}
on *:text:*goo.gl*:#channelname:{
msg $chan .timeout $nick 600
}
on *:text:*tinyurl.com*:#channelname:{
msg $chan .timeout $nick 600
}
on *:text:*clck.ru*:#channelname:{
msg $chan .timeout $nick 600
}
on *:text:*bit.ly*:#channelname:{
msg $chan .timeout $nick 600
}
on *:text:*j.mp*:#channelname:{
msg $chan .timeout $nick 600
}
@Nos
The snippet title says this is for Twitch. Twitch has no modes (including bans) and no /KICK command. Twitch commands are sent in a PRIVMSG to the channel and are prefixed with a slash or dot [/.] - in other words, the commands in the snippet were correct to begin with.
$+(,cutt.us,) evaluates to "cutt.us", which is exactly the same as the match that was already being used. Besides making the event shout (TEXT vs text) and adding some around the channel match section of the event to confuse noobs, I have no idea what you were trying to accomplish with that post.
Also, in your haste to show off you forgot to escape the \dot in your regex (which should really be in the matchtext section of the event, instead of using a * wildcard match and an if ($regex()) { }). Some form of explanation as to what any of your responses mean/do and the benefits of using one method over another would probably be useful to anyone who visits this page, since this snippet contains examples of the simplest possible on text events; anyone coming here for help will likely have no idea what they're looking at. This is especially true for the regex example. Explaining why you ended the expression with \b, or the significance of the @ prefix on the event would be a good place to start.
@Nos
Neither of those are correct for twitch, since you're still using /ban which won't work there.
I still don't know why you're using a dynamic matchtext in the wildcard match (the top one). Using "$($+(,cutt.us,))" does exactly the same thing as if you had put "cutt.us". It's complicating an otherwise simple example and gaining no benefit.
I would lean towards the regex example, with a few changes:
on @$*:text:/\b(\Qcutt.us\E|\Qexample.com\E|\Qstring_three\E|\Qstring_four\E)\b/iS:#channelname:msg # .timeout $nick 600
Explanation:
For anyone looking at this expression and thinking it looks a lot more intimidating than using a plain wildcard match on text event for each new site, it's actually fairly simple once you know how it works. It uses three main regex concepts: alternation, escaping (special characters), and word boundaries. I've linked explanations to two of those concepts already. Here's the third: http://www.regular-expressions.info/alternation.html
Hope this helps clarify for anyone reading.