Skip to content

Description

Our Twitch notification module is designed to provide your community members with an advanced, interactive and automated stream tracking experience on Discord!

  1. Stream start detection
  2. As soon as the stream starts, the module automatically creates a notification in the Discord server by retrieving the pre-configured stream start image and creating a ping to the configured role, displaying a dynamic preview and all useful stream information (viewer count 👀 & start time ⏰).

    Twitch live 'on' image
  3. Automatic data updates
  4. Every minute ⏱️, the module analyzes the stream’s evolution in real-time: it updates the Discord message with new statistics 📈 (viewer count 🎉 & a stream screenshot 📸).

    Members thus have fresh information if they come to see the notification later. This ensures that the streamer is still live if the notification is read later!

    Twitch live 'in progress' image
  5. Managing interruptions and stream end
  6. If the stream experiences an interruption 🔌, the module checks for 10 minutes ⏳ if the interruption is temporary (connection loss, restart…).

    • 🟢 If the stream restarts, the notification turns green again (active stream) ✅
    • 🔴 Otherwise, after this delay, the message turns red, considered as a stream end, and all final statistics are displayed: start time, end time, stream duration, peak viewers & number of new followers (The pre-configured stream end image will be displayed) 📋
    • Twitch live 'stop' image
    • 🟠 During the interruption, the status is indicated in orange on the message to warn of any anomaly ⚠️
    • Twitch live 'pending' image
  • 👁️ Real-time visibility of streamer activity directly on Discord
  • 🎨 Enhanced community engagement through dynamic and illustrated notifications
  • 📚 Automatic history: the entire stream timeline (statistics, evolution) is archived in a single Discord message, for each stream 🗂️
  • 🔄 Update a voice channel to display the number of followers on the Twitch channel when the live stream starts and ends
Twitch stat image

With this module, each Twitch stream becomes an interactive event 🎊 perfectly integrated into your Discord server, without manual management 🤖, for a more lively atmosphere and complete reporting for each broadcast! 🎉🔥

  • The module is not functional by only downloading the files; it must be integrated into an already working Discord bot
  • We use Prisma as the ORM for database management; ensure your project also uses Prisma or adapt the code accordingly
  • A working Discord bot with the necessary permissions to register slash commands
  • You should have knowledge in Discord bot development (Javascript) & database management to use this script in order to adapt it to your needs
  • Directoryimages
    • Directoryscreen-live/ Contains temporary stream images
    • offline.png
    • online.png
  • Directoryprisma
    • schema.prisma Data model for the module (Prisma)
  • Directoryutils
    • Directorynotification
      • twitch.js Functions used to manage module notifications
    • environment.js Utility function for writing a variable to the .env file
    • utils.js Reusable functions
  • .env Required environment variables
  • index.js Script entry point
  • package.json Required dependencies

Here are the versions used for development and testing of the script:

  • @prisma/client@6.18.0
  • discord.js@14.24.0
  • dotenv@16.6.1
  • moment@2.30.1
  • fs@0.0.2
  • axios@0.26.1
  • uuid-js@0.7.5
  • utf8@3.0.0