Best Practice for Detecting Cheers?

I’ve been getting some erratic behavior lately regarding cheers. I’ve been just reading chat for the amount of bits. Sometimes it triggers TWICE, which is odd.

The other idea is I think TwitchLib may now be outdated, so it isn’t doing this correctly. It seems I need to roll my own?

Also, can’t use EventSub for webhooks. This is an installed app running on the user’s PC. There is no HTTPS endpoint that could be passed to Twitch for the subscription callback.

Each event should have a unique ID. You may have to cache IDs to avoid duplication.

1 Like

I don’t think that’s the case with chat, which is how I’m detecting and handling them now.

All chat messages have a unique ID

And since cheers broadcast as a chat message you can pull that ID from the tags and dedupe if needed

I’ve not seen duplicates for a while, so check you don’t have two connections spun up

1 Like

Oh interesting! I had no idea. I assume it’s “tmi-sent-ts” ?

no tmi-sent-ts is the server timestamp for the message

you want the id

As per this JSON-ified example

{
"command":"",
"room":"#cohhcarnage",
"nick":"barrycarlyon",
"target":"",
"body":"A test messge",
"tags":"badge-info=subscriber/83;badges=moderator/1,subscriber/78,ambassador/1;client-nonce=383a7d808766b10a460a9997fdab7a46;color=#033700;display-name=BarryCarlyon;emotes=;flags=;id=3b010d43-af3f-4f58-a8e6-11128e8fa4c6;mod=1;room-id=26610234;subscriber=1;tmi-sent-ts=1607696996823;turbo=0;user-id=15185913;user-type=mod"
}

If you look in the tags you will see an id of 3b010d43-af3f-4f58-a8e6-11128e8fa4c6

1 Like

Oh JEEZ, never even saw that in there. Been writing bots for Twitch for ~5 years now. Thanks for the help!

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