twitch-live-discord
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
Setup
- Register an application with Twitch. Note the
Client ID
andClient Secret
- Create a Webhook in Discord. Note the
Webhook URL
- Make sure python-dotenv is installed
sudo apt -y install python3-pip
pip install 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>
Execute the script
- Run the script to with the following command.
python3 script.py