Unban and untimeout notices

So recently I noticed that my bot stopped capturing unban and untimeout actions. I use tmi.js and that code worked before, i’m sure. Now, I don’t see any notices or other type of messages on unban/untimeout action even while looking at browser websocket. There are changes on timeout action too, but there is some message atleast. How am I supposed to capture these actions now?

Chat doesn’t broadcast moderator actions. So not sure why you are saying there were there are now are not.

Just CLEARCHAT (with a optional duration)

To monitor moderator actions you need pubsub or eventsub. (The former more likely)

See chat/chat_moderator_actions under PubSub | Twitch Developers

Will report room state changes and the like.

But not ban/unban/timeout/untimeout.

You’ll get responses that the “user you are logged in as” do in response.
But not actions that other people do

So what’s this then IRC: msg-id Tags | Twitch Developers ?
There are notices like unban_success, timeout_success and untimeout_success. And things like capturing notice (client.on(“notice”)) and if(msgid === ‘timeout_success’) worked some time ago for ALL moderators actions, not user i’m logged in. Now there are no NOTICEs from the server for these actions.

Those respond when the user the bot is logged in as does a thing.
Not when other moderators do them.

timeout_success is sent in response to the user you are logged in as, sending the timeout command (if it was successful)
untimeout_success is sent in response to the user you are logged in as, sending the untimeout command (if it was successful)

Checking my own logs I do not see this being reported for not the user my bot is logged in as

Yeah it’s actually my bad, looking at wrong lines of code.
What actually changed is this

		case "CLEARCHAT":
				// User has been banned / timed out by a moderator..
				if(message.params.length > 1) {
					// Duration returns null if it's a ban, otherwise it's a timeout..
					var duration = _.get(message.tags["ban-duration"], null);

					if(_.isNull(duration)) {
						this.log.info(`[${channel}] ${msg} has been banned.`);
						this.emit("ban", channel, msg, null, message.tags);
					}
					else {
						this.log.info(`[${channel}] ${msg} has been timed out for ${duration} seconds.`);
						this.emit("timeout", channel, msg, null, ~~duration, message.tags);
					}
				}

In tmi.js it was client.on(“timeout”) and bot was actually able to see timeouts and bans in the room. And now i should implement this through eventsub?

This hasn’t changed.

CLEARCHAT’s are sent to everyone as it’s an instruction to “remove this message from view” regardless of the permissions of the user connected to chat.

So if you are no longer logging it/seeing it, then you’ve got a bug somewhere in your code or in TMI.js itself.

I have tested this and it still works as expected.

Connected a non mod to my channel.
Then in another window timed someone out.
And my non mod saw a CLEARCHAT with the relevant tags.

Course CLEARCHAT will report bans and timeouts but there are no events for untimeout/unban over IRC.

EventSub or PubSub would be a more optimal way to monitor for moderation events in my opinion.

Yeah, wrote this code some time ago so forgot that there’s actually no untimeout event for everyone. Still there’s some kind of bug with clearchat not capturing, i’ll look into implementing it thru eventsub, thanks for advice. And thanks for your help and fast reply!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.