A simple node.js application that monitors BWC Members' YouTube channels for live streams and posts them to a Discord channel using a webhook.
- Node.js (https://nodejs.org/en/download/) (v16.9.0 or higher)
- NPM (https://www.npmjs.com/get-npm) (should be installed with Node.js)
- PM2 (https://pm2.keymetrics.io/docs/usage/quick-start/) (Optional) - Used to run the application as a service.
- A Discord channel with a webhook.
- A list of BWC Members' YouTube channel IDs.
- Download the latest release from the releases page.
- Extract the zip file to a directory of your choice.
- Open a terminal window and navigate to the directory where you extracted the zip file.
- Run
npm installto install the required dependencies. - Run
npm run startto start the application. - The application will now be running in the terminal window. You can close the terminal window if you wish.
- To stop the application, press
CTRL + Cin the terminal window.
- Download the latest release from the releases page.
- Extract the zip file to a directory of your choice.
- Open a terminal window and navigate to the directory where you extracted the zip file.
- Run
npm installto install the required dependencies. - Run
pm2 start ecosystem.config.jsonto start the application as a service. You can then usepm2 stop <name>/<id>to stop the application, andpm2 restart name>/<id>to restart the application. - If you wish to run the application as a service on startup, you can use PM2 to do so. Run
pm2 startupto generate the startup command for your system. Then run the command that was generated to enable PM2 to run on startup. Then runpm2 saveto save the current PM2 configuration. You can then usepm2 stop name>/<id>to stop the application, andpm2 restart name>/<id>to restart the application.
- Open the
config.jsonfile in a text editor. - Replace the
iconURLvalue with the URL of the icon you wish to use for the embeds. - Replace the
messagevalue with the message you want to be sent to the Discord channel. - Add the members channel id to the
Youtubersarray. - Save the
config.jsonfile.
- Open the ecosystem.config.json file in a text editor.
- Add your YouTube API key to the
YOUTUBE_API_KEYvalue. - Add the webhook url to the
WEBHOOK_URLvalue. - Save the
ecosystem.config.jsonfile.
- The
messagevalue supports Discord markdown. - You can find a member's channel id by going to their channel and copying the last part of the URL. For example, the channel id for https://www.youtube.com/channel/UC0ZV6bqO9oBSvvXWvqsYeNw is
UC0ZV6bqO9oBSvvXWvqsYeNw. You can add multiple channel ids to the array. The application will monitor all of the channels in the array. If the channel id is not in the url, you will have to find it using a tool such as https://commentpicker.com/youtube-channel-id.php.
The application uses the winston logger to log messages to the console and to a log file. The log file is named Youtube-API-Discord.log.
- Fork the repository.
- Create a new branch for your changes.
- Make your changes.
- Create a pull request.
- Enjoy!
If you have any questions, feel free to contact me at:
- BWC Discord
[BWC] Patrick - BWC Forums
Patrick.
- Black Widow Company - Development
- Node.js - Application Development
- NPM - Package Management
- PM2 - Process Management
- Winston - Logging Library
- Discord.js - Discord API Library
- YouTube API - YouTube API
