How Do I Add YouTube to My Discord Server?


Scott Campbell

Are you a Discord server owner or an admin looking to add some multimedia content to your server? Adding YouTube to your Discord server is a great way to enhance the user experience and keep your members engaged. In this tutorial, we’ll walk you through the step-by-step process of adding YouTube to your Discord server.

Step 1: Creating a Bot on Discord

To add YouTube functionality to your Discord server, you’ll need to create a bot. Follow these steps:

  1. Create an Application: Go to the Discord Developer Portal and create a new application. Give it a name and click on “Create”.
  2. Create a Bot: In the “Bot” tab of your application’s settings, click on “Add Bot”. Confirm by clicking “Yes, do it!

  3. Enable Presence Intent: Under the “Privileged Gateway Intents” section, enable the “Presence Intent” toggle.
  4. Add Bot to Server: Scroll down to the “OAuth2” tab and select the “bot” scope. Copy the generated URL and open it in your browser. Choose a server where you want to add the bot and authorize it.

Step 2: Obtaining YouTube API Key

In order for our bot to interact with YouTube, we’ll need an API key from Google’s Developer Console. Here’s how you can get one:

  1. Create Project & Enable API: Go to the Google Developer Console, create a new project, and enable the YouTube Data API v3 for that project.
  2. Generate API Key: In the “Credentials” tab, click on “Create Credentials” and select “API Key”. Copy the generated API key.

Step 3: Adding YouTube Functionality to your Bot

Now that we have our bot and YouTube API key, let’s add YouTube functionality to your Discord server:

  1. Install Required Packages: Open your preferred code editor and create a new project folder. Open a terminal and navigate to the project folder. Run the command npm init to initialize the project. Install the required packages by running npm install discord.js youtube-api-search dotenv.
  2. Create Bot Instance: Create a new JavaScript file, e.g., bot.js, and require the necessary packages.

    Initialize Discord.js client using your bot token.

  3. Add Command for YouTube Search: Implement a command that searches for YouTube videos using the YouTube Data API v3. Use the API key you obtained earlier.
  4. Add Bot to Your Server: Go back to your Discord Developer Portal, select your application, and copy the client ID. Visit this URL in your browser: Replace YOUR_CLIENT_ID with your actual client ID.

Step 4: Testing Your Bot

You’re almost there! It’s time to test your bot and see if everything is working as expected:

  1. Start Your Bot: Open a terminal in your project folder and run the command node bot.js to start your bot.
  2. Interact with Your Bot: Go to your Discord server and test your bot by using the command you implemented earlier. Make sure it responds with the expected results.


Congratulations! You’ve successfully added YouTube functionality to your Discord server.

Now, you and your server members can enjoy sharing and watching YouTube videos directly within Discord. Feel free to explore more options and customize your bot further to suit your server’s needs.

Remember, adding a YouTube bot allows you to incorporate multimedia content into your Discord server, making it more engaging and enjoyable for everyone involved!

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy