Skip to content

Installation

Follow these steps to correctly install the script on your bot.

  1. Download the module & unzip the folder

    Retrieve the module folder (often in .zip or .rar format) from the official source. Use a tool like WinRAR or 7-Zip to extract the script folder to your computer.

  2. Creating your YouTube API keys

    • Logging into the Google Developer platform
      Go to: Dashboard to log in or create an account to access the dashboard.

    • Create a project
      Click on Create project, then enter the name of your project and confirm the creation.

    • Activating the YouTube API on your Google account
      Go to: YouTube API to activate the Google API.

    • Creating your application
      Click on Credentials or go to this link: Credentials


      Click on Create credentials, then choose API Keys


      Fill in the following fields:

      • Name (the name of your application, e.g., BotYoutube)
      • Application restrictions => IP Addresses and enter the IP address of your VPS/your machine
      • In the API restrictions section, select YouTube Data API v3

      Then confirm the creation. A key will be displayed for you to put in the .env file.


    • ⚠️ If you do not wish to pay, you have a daily quota to respect
      Through the module, you can enter up to 5 YouTube accounts. If you want more, you will need to adjust it on the page Quotas

  3. Configure the environment variables

    Open the .env file provided with the script and add & modify the necessary environment variables for the proper functioning of the module.

    • youtubeChannelID : ID of the channel where YouTube notifications will be sent
    • youtubeRoleID : ID of the role of people wishing to receive notifications (Generally the member role to notify the entire server or a role created by you so that members can choose this role to be notified of a new video!)
    • youtubeAPIKey : The YouTube API key (See step 2)
    • youtubeChannelFollowerID : ID of the voice channel that will be updated regarding the number of followers (Configure the account in the code, see the next step)
  4. Copy/move the files/codes into your project

    Copy the following files into the appropriate folders of your Discord bot project:

    • commands/notification/notification-add.js : in your commands folder
    • commands/notification/notification-list.js : in your commands folder
    • commands/notification/notification-remove.js : in your commands folder
    • utils/notification/youtube.js : in your utilities folder
    • utils/utils.js : in your utilities folder

    Also, copy the indexing code of the module into your main index.js file. In this file, we added prisma directly related to the “client” object, place this code in yours or adjust it according to your way of using prisma.

    ❗ If you wish, you can modify PSEUDO_UPDATE_CHANNEL_STAT to update the statistics channel or comment this line. The pseudo must be the same as the one encoded in the database.

    Youtube notification stat image
  5. Update the database schema

    Add the data model for retrieving notifications of new YouTube videos in your prisma/schema.prisma file and run the necessary migrations to apply the changes to your database. Execute the following command:

    Terminal window
    npx prisma generate
    npx prisma migrate dev --name add_youtube_notification
  6. Install the dependencies

    Make sure the necessary dependencies are installed by checking your package.json and running:

    Terminal window
    npm install
  7. Restart the bot

    Restart your bot for the script to be taken into account.


  • For the /notification-add command, you need to enter the name of the YouTube channel indicated in the channel’s URL. Example: https://www.youtube.com/@Joyca => The name to enter when using the command is Joyca (without the @).