Chat Moderation Script Issues
I’m working on a moderation script for streaming chat and running into several problems. Here’s my current setup:
//MODERATION SYSTEM
on @*:text:*:#:checkMessage $1-
on @*:action:*:#:checkMessage $1-
on @*:notice:*:#:checkMessage $1-
alias -l checkMessage {
if ((!%cooldown) && (!$hfind(allowed,$nick))) { inc -u3 %cooldown
var %modCommands /^!(filter\so(n|ff)|(allow))\b/iS
var %sites net|org|com|edu|info|co|uk|de|fr
var %whitelist /(?:https?:\/\/)?w{3}\.(twitch|gyazo|prntscr)\.com/
var %urlPattern /(?<=^|\s)((?>\S{4,9}:\/\/|w{3}\56)\S+)|\56( $+ %sites $+ )\b/iS
if ($findtok(%activeChannels,#,1,32)) && ($nick(#,$nick,vr)) && ($regex($1-,%urlPattern)) && (!$regex($1-,%whitelist)) {
timeout 45 # $nick | /mode # -b $nick
msg # $nick $+ , links require moderator approval. Request !allow permission first.
msg # /timeout $nick 2
}
elseif (($regex($1-,%modCommands)) && ($regml(1) = allow) && ($nick isop #) && ($$2 ison #)) {
hadd -mz allowed $v1 45 | notice $v1 Link posting enabled for 45 seconds!
msg # Permission granted for 45 seconds!
}
elseif (($regml(1) = filter on) && ($nick isop #)) {
goto $iif(!$istok(%activeChannels,#,32),enable,skip)
:enable | set %activeChannels $addtok(%activeChannels,#,32)
.msg # URL Filter activated for: $+($chr(2),#)
halt | :skip | .msg # Filter already running in $+($chr(2),#,$chr(2))
}
}
}
Main Problems:
Approved links getting blocked anyway
My whitelist isn’t working right. URLs from approved sites still trigger timeouts even though they should be allowed through.
Permission system fails randomly
The !allow command works sometimes but not always. I think it might be related to username formatting but I’m not sure what’s causing the inconsistency.
Script conflicts with other features
I have basic command responses that sometimes stop working:
//Basic Commands
on *:TEXT:!help:#mychannel: {
if ((%helpFlood) || ($($+(%,helpFlood.,$nick),2))) { return }
set -u10 %helpFlood On
set -u20 %helpFlood. $+ $nick On
msg $chan Available commands: !schedule|!discord|!social
}
on *:TEXT:!schedule:#mychannel: {
if ((%schedFlood) || ($($+(%,schedFlood.,$nick),2))) { return }
set -u10 %schedFlood On
set -u20 %schedFlood. $+ $nick On
msg $chan Stream schedule: Monday/Wednesday/Friday 8PM EST
}
Sometimes these commands just don’t respond at all. Could my moderation script be interfering?
I’m pretty new to mIRC scripting and could really use some help debugging these issues. My goal is to block all URLs except a few trusted domains. Any suggestions would be great!