Which npm package should I choose for Discord music bot development?

Hey folks!

I’m working on building a Discord bot that can play music. I want to make it available as a free self-hosted option for communities. I’ve been looking into different packages like ytdl-core and discord-player, but I’m not sure which one is the best choice.

I heard there were some issues with YouTube streaming in Discord bots a while back. Are those restrictions still active? Also, what would you suggest as the most reliable npm module for handling audio streaming in Discord? I want something that’s stable and won’t break easily.

Thanks for any advice!

I’ve been running a Discord music bot for about 8 months now and can share some insights from actual usage. The YouTube restrictions are still there - YouTube actively blocks bot traffic, so you’ll run into frequent 403 errors with ytdl-core alone. I switched to using @discordjs/voice as the core audio handler combined with play-dl for source extraction. This combination has been much more stable than the older solutions. The key thing I learned is having fallback sources. My bot tries YouTube first, then falls back to SoundCloud when YouTube blocks the request. Also consider implementing proper error handling and reconnection logic because audio connections can be finicky. Make sure you’re using the latest discord.js v14 - the voice handling improved significantly from v13.

honestly discord-player is pretty solid these days, been using it for like 6 months without major headaches. it handles most of the youtube bs automatically and supports spotify links too which is nice. just dont expect it to work 100% of the time because discord’s voice stuff can be weird sometimes

From my experience building a community bot that’s been running for over a year now, I’d recommend avoiding ytdl-core entirely at this point. The YouTube API changes and bot detection have made it increasingly unreliable. What worked best for me was implementing distube which abstracts away a lot of the complexity and handles multiple sources automatically. It comes with built-in queue management and playlist support which saves you from writing that logic yourself. The main advantage is that it automatically switches between different extractors when one fails, so your users don’t experience as many playback interruptions. One thing to note though - whatever package you choose, make sure to implement proper rate limiting and consider using a VPN rotation system if you expect heavy usage. Also budget for hosting costs because these bots can be resource intensive when serving multiple servers simultaneously.