Make it so mods can't ban

Is this possible? Could I set up a bot to detect when a mod bans somebody and unbans them instantly? I want it so only the stream’s owner can ban people.

You can listen to CLEARCHAT and if the ban-duration tag is missing, instantly /unban the target. You’ll need both commands and tags capabilities enabled. See the topic below for more information.

Here are example for a clearing all chat, a timeout and a ban (in that order) CLEARCHAT #freddyoriginal
@ban-duration=100;ban-reason=test CLEARCHAT #freddyoriginal :testuser1
@ban-reason= CLEARCHAT #freddyoriginal :testuser1

But the question is why do you mod people you apparently can’t trust/do what they want in the first place?

I just get this if I timeout somebody: ROOMSTATE #ice_poseidon CLEARCHAT #ice_poseidon 400plus20

You need to be looking at the raw messages, something’s stripped the colons there (and tags, if those are enabled).

These are the CAP REQ I have
not sure why I can’t see them

You don’t see tags at all or only for CLEARCHAT?

If you don’t see any of them do you get acknowledgements back when requesting CAPS? e.g. CAP * ACK

I only see the tags for CLEARCHAT, I don’t get acknowledgements when I request CAPS.

Fixed it, I made a mistake when requesting them. Sorry
Now I get this when I time somebody out:

If I wanted to accomplish this, I’d probably mod only my bot, and create a list of users who have timeout/clearchat access on the bot. Set the max seconds for a timeout, give no option to set a ban.

I don’t seem to be getting CAP * ACK

Your screenshot looks like mIRC. If that’s the case open a debug window before connecting by typing

/debug @raw

and then connect to see all incoming and outgoing raw messages in the @raw window. Maybe you can figure out where the issue is.

Right, when I do that I can see it.

Do you know how I can see it without being in debug mode though? Thanks for helping though

mIRC doesn’t show tags in a channel. If you want to see them for CLEARCHAT or you want to show different messages depending on whether it’s a timeout or ban you have to make your own script afaik

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:

  ; $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.

That works, thanks. Is the name of the person who actually banned the person echoed?

Information on who issued a mod action is not available in Twitch Chat at this time.

Is there a limit to how long you can time somebody out?

Based on the response of the timeout command (You cannot time a user out for more than 1209600 seconds.) the maximum is 14 days.

Wouldn’t that echo be triggered on the /clear command since the corresponding CLEARCHAT message doesn’t have tags at all?

Another thing worth mentioning, this script will also be triggered when you (the streamer) ban someone because there’s no information about the mod who did it as tduva already said.