Once you sent all the required CAP commands (which you already do now based on the raw output you posted), you can add this to a script:
raw CLEARCHAT:*:{
; $1 - channel
; $2 - user
if ($msgtags(ban-duration).key == $null) {
echo -a chan: $1 user: $2
}
}
It will echo a message when the ban-duration tag doesn’t exist on the message. You’d want to replace that with whatever you want to do. Make sure you actually request the tags capability, because otherwise this won’t work as intended.
You won’t see the ACK to the CAP request in the status window, because mIRC hides that. You should see it in the debug output though.