Python script to authenticate against the Twitch API, get live user details and then post a rich text message to a channel in Discord. The reason I built this instead of using a bot is that most bots do not add a random number to the preview URL, resulting in a cached image in Discord
- Register an application with Twitch. Note the
Client ID
andClient Secret
- Create a Webhook in Discord. Note the
Webhook URL
- Make sure python and python-dotenv are installed
brew install python
/opt/homebrew/bin/python3 -m pip install --break-system-packages python-dotenv requests
- Create a
.env
file in the root directory to put the follow variables
TWITCH_USER="twitch_streamer_name"
CLIENT_ID="<your twitch app client id"
CLIENT_SECRET="<your twitch dev secret>"
WEBHOOK_URL="https://discord.com/api/webhooks/<REST OF THE URL>
- Run the script to with the following command.
python3 script.py
- To launch with StreamDeck Use the System -> Open option
- If you are using Windows Subsystem for Linux you can launch with this command
wsl.exe "/usr/bin/python3" "/home/user/git/twitch-live-discord/script.py"
- StreamDeck will only open
.sh
files so selectbash-python.sh
you will need to edit the hardcoded path to
script.py
inside this file to match your system