Okay i drove myself nuts with the variables so i decided to do it differently. Used userlevels to check wheter or not someone has posted before and it's working pretty well. Also merged the domain 'pods' into one paragraph for a cleaner look and merged the toggle on/off function into a single event. Starting to look like something now
on *:text:!links*:#: {
if ($nick isop #) {
if ($2 == on) {
if (%links) {
msg # Link protection is already enabled
return
}
else {
msg # Link protection enabled
set %links On
return
}
}
if ($2 == off) {
if (%links) {
msg # Link protection disabled
unset %links on
return
}
else {
msg # Link protection is already disabled
return
}
}
else { msg # ' $+ $2 $+ ' is not a valid function. use '!links on' to enable link protection and '!links off' to disable it again. }
}
}
on *:text:!permit*:#: {
if ($nick isop #) {
if (%links) {
set -u30 %permit $addtok(%permit,$2,32)
msg $chan You have 30 seconds to post a link, $2
}
}
}
on +201:text:*:#: {
if ($nick isop #) { return }
if ($istok(%permit,$nick,32)) { return }
if (%links) {
if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
.ruser 201 $nick
msg # /timeout $nick 86400
msg # That was your 3rd link. Try again tomorrow, $nick [Link] [24h]
return
}
}
}
on +200:text:*:#: {
if ($nick isop #) { return }
if ($istok(%permit,$nick,32)) { return }
if (%links) {
if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
.ruser 200 $nick | .auser 201 $nick | .timermsg 1 3600 .ruser 201 $nick
msg # /timeout $nick
msg # No links without permission, $nick $+ ! [Link] [Timeout]
return
}
}
}
on *:text:*:#: {
if ($nick isop #) { return }
if ($nick == PUT CASTER HERE) { return }
if ($istok(%permit,$nick,32)) { return }
if (%links) {
if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
msg $chan /timeout $nick 10
msg $chan Please ask permission before posting a link, $nick [Link] [Warning]
.auser 200 $nick | .timermsg 1 3600 .ruser 200 $nick
return
}
}
}
**It will check for perms first, if someone has no permission/is not OP it will proceed to check for links. If links are detected it will timeout the sender and give them a higher userlevel. The higher userlevel, the higher punishment. (1 link gets you userlevel 200 and a purge. 2 links get you userlevel 201 and a 10 minute timeout, the third link gets you a 24h ban and resets the userlevel) In the last paragraph you'll notice i have added an extra check for the caster. I did this because it takes Twitch IRC some time for it to send out modes and the last thing you want is have your bot try to time a caster for posting links in his own channel :P
Pretty proud of my first doodle. I think this is about the best i can get it without diving head first into regex, which i dont know aaaanything about. If you have any suggestions to make it better, or if i overlooked something, please let me know ^_^
A very interesting set up. how has it been working for you?