example

command
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 7 Imported by: 0

README

Twitch PubSub Go Example

  1. You'll need two Twitch accounts for this example, let's call them Account A and Account B.
  2. Generate an OAuth Access Token for Account A.
  3. Run the steps below:
CHANNEL="Account A: Twitch channel name" # i.e. tracy_and_matt

TOKEN"Account A: OAuth Access Token" # see link above, without the `oauth:` prefix

TWITCHAPPS_TMI_CLIENT_ID="q6batx0epp608isickayubi39itsckt" # no need to change

USER_ID=$(curl -s -H "Client-Id: $TWITCHAPPS_TMI_CLIENT_ID" -H "Authorization: Bearer $TOKEN" \
  https://api.twitch.tv/helix/users?login=$CHANNEL | jq -r '.data[0].id')
echo $USER_ID # to confirm

go build

./example -token $TOKEN -topic whispers.$USER_ID
  1. Logged-in as Account B, go to Account A's twitch channel and start whispering.
  2. The script will start printing the whispers.

You can download jq here or just parse the returned JSON from the curl request and set USER_ID manually.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL