Hello, I'm looking to build my own twitch bot, there is not a lot of source release...
actually I'm "Coding it" in .mrc ( have no clue where I can host it instead on my own pc)
I'm looking to get the .timeout command working automaticaly once someone post a link not allowed, so far my script is working, but I'd like to add some variable (if people post a link from youtube - the link will remain and people will not be ban)
here is the code working so far
help would be appricaite :)
on $*:text:/\.(?=com\b|net\b||dk\b|org\b|ca\b|uk\b|tv\b|name\b)/iS:#:{
/msg $chan .timeout $nick | /msg $chan Whoa! $nick , Don't Post links in here without permission from a mod.. Cya in 10 mins B) }
Here's a script I wrote: http://www.hawkee.com/snippet/9960/
I'll start by saying that it's probably not what you're looking for. However, you could re-use many of the aliases I've written for it to detect links in your twitch chat. I'd suggest opening it in another tab and then using ctrl+f to find the aliases I'm about to reference.
For example:
on $*:text:$($catchURLex):#:{
This event would trigger when any URL was posted. However, it would also trigger for text like 'o.o'
To remove false matches, you would do the following:
var %urls $extractURL($1-)
if (!%urls) return
Inside $extractURL() I use an alias called $parseDomain(), which uses Mozilla's public suffix list to determine if the suffix used (such as .co.uk or .net) was valid or not. This means only valid domains are returned by $extractURL().
From there, you have the URLs posted inside %urls. You'd just need to loop through them and determine if the domain is whitelisted or not. For that, I have an alias called $trusted(). If $trusted(example.com) == $true, then the site is whitelisted.
It may be overkill for what you want, but if you're interested everything you'd need is in that script.