CLEARCHAT being sent multiple times

Hello everybody,

While parsing chat from few top channels where there’s a lot of people talking (and timeouts) I’ve been noticing that sometimes I am receiving several CLEARCHAT in a row.

Log example (removed almost everything for anonymity):


Just wanted to know if it’s the server that is sending it to me multiple times or the moderating bots either 1) overzealous 2) doing each other’s job

Most likely bots/mods timing the user out, I know moobot times a person out 3-5 times, and then another mod could ban/time him out even more(depending what the user did).

Why would Moobot or any single bot do this on purpose? Each timeout overrides the last.

It’s to make sure the message is actually deleted for all clients. It’s possible for the CLEARCHAT to arrive before a client actually received the message. I’m not quite sure how that works, but I’ve added a second delay for timeouts in my own scripts because otherwise the message sometimes wouldn’t be deleted for all clients. It’s also possible that it was for when messages in general got eaten more regularly.

1 Like

There are 2 reasons bots send timeouts at least twice. The first reason is what @tduva mentioned: sometimes if the timeout is sent too quickly after the message arrived, the client will think the timeout came before the message and the message remains. (I’ve only experienced this with BTTV, but I’m not sure how widespread it is.)

The other reason is historical: the chat was often unstable throughout 2014 and message timeouts were common, so bots sent multiple timeouts to make sure the message actually got removed. The chat has been very stable for a long time though, so sending more timeouts for this reason is largely useless nowadays.

I’ve only experienced this with BTTV, but I’m not sure how widespread it is.

So essentially this is due to how messages are rendered, and is something I’ve been meaning to fix. Messages are received before CLEARCHAT, but are not on the screen when a CLEARCHAT was sent. Because inserts into the DOM and scrolling the chat area down are resource intensive, we batch messages and render them at an interval to prevent chat from freezing up the page. Twitch use to also do this, but has since moved to ember (which binds messages in the DOM to JS). Twitch only runs scrolling down on an interval from what I can tell.

I have been considering swapping to 1 timeout in Nightbot since chat has stabilized now, but I will need to test that mobile clients don’t have such an issue before I make such a change.


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