mechevarria / twitch-live-discord

Python script to post Twitch Live stream details to a channel in Discord

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 and Client Secret

twitch-app

  • Create a Webhook in Discord. Note the Webhook URL

webhook

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
  • Example output in Discord discord

About

Python script to post Twitch Live stream details to a channel in Discord


Languages

Language:Python 100.0%