Skip to content

Prerequisites

Jared Dantis edited this page Oct 18, 2023 · 3 revisions

With Discord's crackdown on music bots that stream from YouTube, the only ways for you to stream YouTube into your voice channels are through Discord's Watch Together Activity, or through a bot that hasn't been vetted by Discord yet. The latter gives you an experience as close as possible to the good old days of Groovy and Rythm, but once the bot grows past a hundred servers or so, Discord is bound to take notice.

However, as long as bots are allowed to transmit audio data in voice channels, there's nothing stopping you from having your own private music bot that you use in your own servers. I hope Blanco helps you realize that vision.

Prerequisites

There are a few things you'll need to prepare to properly deploy Blanco in your own servers.

Lavalink instance

You will need a working Lavalink 4.x.x server for your own bot instance to work. There is a list of free servers here, but you need to check if your chosen server is running Lavalink version 4. Lavalink version 3 will not work with Blanco.

You could also choose to run Lavalink along with your bot, but make sure you have enough resources to run both Lavalink and the bot. The CPU doesn't really matter, but absolute minimum memory is 1GB of RAM. This will be enough for a few guilds but you will need more as your bot grows.

Proceed to the Lavalink docs to get started, then return here once you have a server up and running.

Hosting

You'll need somewhere to run your bot, of course!

Setting up a server is beyond the scope of this document, but make sure that by the end of it you'll have either Python 3.11+ or Docker Compose available and working before you proceed.

Virtual private servers

My own instance(s) of Blanco run on an ARM Ampere A1 node on Oracle Cloud's Always Free platform. You can run yours on the same or on Google Cloud's Free Tier or any other free VPS providers.

It is preferable, however, to deploy your bot on a paid VPS, as those will often have better reliability and performance. This will matter more when you run your own Lavalink node along with Blanco. You can look at Linode, Hetzner, DigitalOcean, or any of the myriad Discord bot hosting providers out there.

PaaS (Replit, etc.)

Some people also have luck deploying Discord bots on PaaS providers like Replit (and Heroku, in the past). At his core, Blanco is just a Python program, so there's nothing stopping you from deploying him on these platforms.

Although keep in mind that the free plans on these platforms often put a limit on the runtime of your program so you'll need some way to keep Blanco running 24/7.

Hosting at home

This is the easiest route if you have a computer you don't mind keeping on 24/7, like an old laptop. There are some cons to consider, however:

  • Power consumption. The computer will be running all the time. Depending on where you live, this will add up significantly in your electricity bill.
  • Internet reliability. Again, since your bot will ideally be always available, your Internet connection has to be reliable.
  • Web server reachability. If you're going to be enabling Blanco's built-in web server for linking Last.fm and Spotify, you will need a way to expose it to the Internet. ngrok and Cloudflare Tunnel work great for this.
  • YouTube rate-limiting. If you run Lavalink alongside your bot at home, chances are you won't have a block of IPv6 addresses you can let Lavalink use unless you're lucky enough to have an ISP that allows Tunnelbroker through. Play too many songs through Blanco and YouTube might impose a ban on your IP.

Web server

Blanco has a built-in Web server that lets your users link their Spotify and Last.fm accounts, so that they can scrobble as they listen, add songs to their Spotify Liked Songs list, and play their playlists using the /playlists command without needing to paste the URL.

If you're enabling this, make sure your chosen hosting solution has a port open and reachable by anyone from a domain. Note the domain down - we'll be referring to it as BASE_URL below.

Discord API tokens

Make sure that you have a bot token from Discord.

It is strongly recommended that you enable the Server Members intent, or Blanco might not see anyone else in his voice channel despite you or other people being connected as well. For this reason, you also need to keep your instance small, as Discord requires verification for bots that use this intent past 100 servers.

If you're going to be enabling the web server, make sure to note down the Client ID and Client Secret under the OAuth2 tab as well. Use https://<BASE_URL>/discordoauth as the callback URL.

Spotify API credentials

Create an application from within Spotify's Developer Dashboard and note down your Client ID and Client Secret. Use https://<BASE_URL>/spotifyoauth as the callback URL.

A note on development mode

All applications created for Spotify's API start out in development mode. Blanco is no exception. Normally this doesn't affect much, but once you start working with API endpoints that deal with user data (say, reading playlists from someone that isn't you) you will run into 403 errors and empty responses.

This is because Spotify requires apps to request for quota extensions before they can access user data. Requesting involves Spotify vetting your app, and as you can probably imagine a music bot that displays metadata from Spotify might not look very good in their eyes.

This leaves you with two choices:

  1. Request for a quota extension and hope you get approved, or
  2. Keep your bot small and invite your friends' Spotify accounts into your application manually (Spotify allows up to 25).

It's up to you to decide whether the extension is worth the hassle. You can also forget about all of this and just avoid using /playlists and the Like on Spotify button - you can still manually give Blanco your playlist URLs and he will happily read them.

Last.fm API credentials

Create an API account at Last.fm and note down your API key and shared secret.¹ Use https://<BASE_URL>/lastfmtoken as the callback URL.

¹ Despite the name, please do not share it!