Discord Bot That Posts YouTube Videos (3-Step Build!)
Remember Ali-A, the OG Call of Duty YouTuber?
Back in the day, he was all about gameplay and commentary.
Now, he’s got a thriving Discord community where he interacts with fans, shares sneak peeks, and, you guessed it, automatically announces his new YouTube videos.
He’s not alone.
More and more creators are leveraging Discord to build deeper connections with their audience.
Imagine this: the moment your latest video goes live, your Discord server explodes with excitement.
No more manually posting links or relying on the fickle algorithms of other social media platforms.
A custom Discord bot does all the heavy lifting, ensuring your most dedicated fans are always in the know.
In 2025, this isn’t just a nice-to-have; it’s a necessity for any serious YouTube content creator.
Let’s dive in and build one together!

So, what exactly is a Discord bot?
Think of it as a tiny, programmable assistant living inside your Discord server.
It can perform all sorts of tasks, from welcoming new members to playing music.
In our case, we want it to be a YouTube video-posting machine.
There are tons of different types of bots out there, each with its own specialty.
Some are designed for moderation, others for gaming, and some, like ours, for content promotion.
The magic behind these bots lies in their ability to communicate with other platforms through APIs (Application Programming Interfaces).
An API is essentially a set of rules and specifications that allows different software applications to talk to each other.
In our case, we’ll be using the YouTube Data API to fetch information about new videos and the Discord API to post messages in our server.
Here’s a breakdown of some key terms you should know:
Don’t worry if this sounds complicated right now.
We’ll break it down step-by-step as we go.
Why bother with all this coding?
Because a Discord bot can seriously level up your YouTube game.
Here are some of the key benefits:
Think about creators like Ludwig, who has built a massive Discord community around his YouTube channel and live streams.
He uses his server to announce new content, host Q&A sessions, and even run community events.
This level of engagement is only possible with a dedicated Discord server and the right tools, like a custom bot.
According to a recent study by Discord (Source: Discord’s Official Blog), servers with active communities and custom bots see a 30% increase in user retention compared to those without.
That’s a huge difference!
First, you’ll need some basic programming skills.
I recommend having a good understanding of JavaScript, as we’ll be using Node.js, a JavaScript runtime environment, to build our bot.
If you’re not familiar with JavaScript, don’t worry!
There are tons of free resources online to get you started, like Codecademy or freeCodeCamp.
Here’s a list of the software and resources you’ll need:
If you don’t already have a Discord server, you’ll need to create one.
It’s super easy:
That’s it! You now have your own Discord server.
Okay, let’s get to the fun part: building our bot!
Now for the code!
I’m going to provide you with a basic example using Node.js and the discord.js and googleapis libraries.
First, create a new folder for your bot project and navigate to it in your terminal.
Then, run the following command to initialize a new Node.js project:
bash
npm init -y
Next, install the required libraries:
bash
npm install discord.js googleapis
Now, create a file called index.js and paste the following code into it:
“`javascript const Discord = require(‘discord.js’); const { google } = require(‘googleapis’);
// Replace with your bot token, YouTube API key, and channel ID const BOT_TOKEN = ‘YOUR_BOT_TOKEN’; const YOUTUBE_API_KEY = ‘YOUR_YOUTUBE_API_KEY’; const CHANNEL_ID = ‘YOUR_YOUTUBE_CHANNEL_ID’; const DISCORD_CHANNEL_ID = ‘YOUR_DISCORD_CHANNEL_ID’;
const youtube = google.youtube({ version: ‘v3’, auth: YOUTUBE_API_KEY, });
const client = new Discord.Client({ intents: [ Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildMessages, Discord.GatewayIntentBits.MessageContent, ], });
client.on(‘ready’, () => {
console.log(Logged in as ${client.user.tag}!);
checkYouTube(); // Initial check on startup
setInterval(checkYouTube, 60000); // Check every minute (adjust as needed)
});
async function checkYouTube() { try { const response = await youtube.search.list({ part: ‘id,snippet’, channelId: CHANNEL_ID, order: ‘date’, type: ‘video’, maxResults: 1, // Check only the latest video });
} catch (error) { console.error(‘Error checking YouTube:’, error); } }
// Implement these functions to store and check posted video IDs let postedVideos = []; // In-memory storage (for demonstration purposes only)
function alreadyPosted(videoId) { return postedVideos.includes(videoId); }
function markAsPosted(videoId) {
postedVideos.push(videoId);
// In a real-world scenario, you’d want to store this data in a database or file.
}
client.login(BOT_TOKEN); “`
Important: Replace YOUR_BOT_TOKEN, YOUR_YOUTUBE_API_KEY, YOUR_YOUTUBE_CHANNEL_ID, and YOUR_DISCORD_CHANNEL_ID with your actual values.
Explanation:
Running Your Bot:
bash
node index.js
If everything is set up correctly, you should see a message in your console saying “Logged in as [Your Bot Name]!” Your bot is now running and will check for new YouTube videos every minute.
Error Handling and Debugging:
Customization:
This is just a basic example. You can customize your bot in many ways:
Congratulations!
You’ve built your own Discord bot that automatically posts your YouTube videos.
This is a powerful tool that can help you engage your community, build a loyal viewer base, and drive traffic to your channel.
In 2025, having a Discord bot is no longer a luxury; it’s a necessity for any serious YouTube creator.
By embracing this trend, you can stay ahead of the curve and build a thriving online community.
Don’t be afraid to experiment with your bot and customize it to fit your brand’s personality.
The possibilities are endless!
Take the leap and build your own bot to enhance your content creation journey.
I’m excited to see what you create!
