Use jq to get Twitch cheermotes as a list

Use jq to get Twitch cheermotes as a list

ยท

2 min read

What are cheermotes?

Cheermotes are the emotes that are reserved for cheering with Bits on Twitch.

Getting the cheermotes can be useful if you need to parse the Twitch IRC chat messages to find out which ones are cheered with bits.

Get cheermotes from the Twitch API

You can get them by making an authenticated call to the following URL:

GET https://api.twitch.tv/helix/bits/cheermotes

I use the TAU abstraction to simplify working with Twitch, so I'm going to call my local instance as follows:

curl --location --request GET 'http://localhost:8000/api/twitch/helix/bits/cheermotes?broadcaster_id=$TWITCH_BROADCASTER_ID' \
--header 'Authorization: Token $TAU_TOKEN'

It will return JSON with a property data which is an array of cheermotes. You can see the shape of the data in the API reference.

You can get them all as a list by piping the output of that to jq:

| jq -r '.data[].prefix'

Putting it all together, it would look like this:

curl --location --request GET "http://localhost:8000/api/twitch/helix/bits/cheermotes?broadcaster_id=$TWITCH_BROADCASTER_ID" \
--header "Authorization: Token $TAU_TOKEN" | jq -r '.data[].prefix'

I don't have any custom cheermotes so this is the list that gets returned:

Standard cheer motes
Cheer
BibleThump
cheerwhal
Corgo
uni
ShowLove
Party
SeemsGood
Pride
Kappa
FrankerZ
HeyGuys
DansGame
EleGiggle
TriHard
Kreygasm
4Head
SwiftRage
NotLikeThis
FailFish
VoHiYo
PJSalt
MrDestructoid
bday
RIPCheer
Shamrock

You can also filter by first-party emotes only:

jq -r '.data[] | select(.type == "global_first_party") | .prefix'

Why tho?

I will be adding a feature to my Twitch multilingual text-to-speech app for macOS to parse messages that contain bits.

I'll be streaming this on Twitch.

ย