1 year ago

Oki I got the backend for the Twitch Overlay Outfit Switching done :3

I will explain exactly how it works in the Article owO

Note that I will not be going into how to set up any of the Initial Websocket stuff,,


ok so we subscribe to channel.poll.end (to get a websocket notification of the poll results)

by sending a request to

https://api.twitch.tv/helix/eventsub/subscriptions

with the data looking something like this,,

image.png

and we also have to put channel:manage:polls in our websocket authorization scopes :3

now when someone redeems this Reward:

image.png

we send a request to https://api.twitch.tv/helix/polls

with the data looking something like this:

{"broadcaster_id":"123456","title":"Streaming next Tuesday. Which time works best for you?","choices":[{"title":"9AM"},{"title":"10AM"},{"title":"7PM"},{"title":"8PM"},{"title":"9PM"}],"duration":300}

(directly taken from twitch's documentation)

the headers are ofc as always

["Authorization: Bearer 'token'", "Client-id: 'clientid'", "Content-Type: application/json"]

all of that STARTS a poll,, since we subscribed to the channel.poll.end websocket notification, we just have to wait for that, which is under "metadata" / "subscription_type" in the response.

which is well,, gonna be "channel.poll.end" on the end of a poll... then we just do this...

image.png

which basically just puts the results INDIVIDUALLY into an array and then uses a custom sort algorithm on it (from most to least)

then we take the first result voteresult[0] which gives us something like [amount_of_votes, "Choice Name"]

then we get [1] on that, to get the name :3 and that's all uwu



3 comments

Loading...

Next up

A quick look at Ryn: And the thread of Life, our game in development, platforms and traps in action.

#gamedev #indiedev #godot

Hyperslice releases on January 16 (yes in just 2 days!) on Steam and Itch ๐ŸŽ‰ โšก Hyperslice is a fast paced arena roguelite where your only weapon is your dash!

Wishlists appreciated ๐Ÿฅฐ (Demo available on Steam and here) https://s.team/a/2977820

Here's the last two attacks for Augusto! First we have a spinning charge, then a foot claw swipe if you get too close.

Short intro of us ๐Ÿ’•โœŒ๏ธ

We're an eletro duo based in Seoul ๐Ÿ‡ฐ๐Ÿ‡ท Heavily influenced by the 90s.

Our new album #Xennials is all about the nostalgia of that era ๐Ÿ’ฝ CD listenin ๐Ÿ“Ÿ beeper beepin ๐Ÿ’พ floppy disks floppin days ๐Ÿ˜Ž

Stream now! ๐ŸŽง

https://open.spotify.com/album/3YwWhnHWVy5cA8XOpbaGRA?si=8E9awqUโ€ฆ

Just as Pecaminosa's musicians #improvise this rendition of #LittleSunflower ๐ŸŒป, so do we improvise with this post you're reading. ๐Ÿ˜‚

What's coming out of your own improvs? ๐Ÿค”

#Pecaminosa | #IndieDev | #OST | #Jazz

Family band complete!

Strange Umbrella

The Darkside Detective: A Fumble in the Dark is out TODAY! ๐Ÿ–ฑ๏ธAdvanced pointing, clicking action ๐Ÿ–จ๏ธVery funny words! Loads of them! ๐Ÿ‘ป6 sarcastic, spectral cases to solve

a drawing I did because I was bored๐Ÿ˜ช. But I love how it turned out.๐Ÿ˜Š