An open source Discord bot I made to play music for my friends.
- To access the bots help menu, use
/helpor mention the bot in a text channel.
- Plays any song of your choice, as long as it's on YouTube!
- YouTube searching enabled, no need to lookup URLs!
- YouTube/Spotify playlist support for quickly adding your favorite songs to the queue!
- Discord slash command support making it easy to control your music!
- Queue up to 500 (can be configured) songs for you and your friends to listen to!
- Join a voice channel. Make sure the bot has permission to connect to the channel you join!
- Use
/play [query]in a channel if your choice. The query can be a search term, a YouTube link, YouTube playlist link, or a Spotify playlist link.- Please note: The text channel where you put the first play command will become the text channel associated with your listening session. This means the bot will send updates and notifications about song playback to that channel. If this channel is not accessible by the bot, it will attempt to use the text channel built into your current voice call. If that channel is not available, it will not send any notification messages. Please make sure you give the bot proper permissions in order for everything to work as intended.
- If you want to restrict commands to certain roles or channels, go
to
Server Settings>Integrations>Freddy Fazbear>Manage.
- That's it! The bot is playing music. There are several other commands for altering your playback
experience, use
/helpto view them all.
- The queue has a hard limit of 500. I may raise this later on but for now it is 500. If you are
self-hosting the bot, you can change the
QUEUE_LIMITenvironment variable. - I am limiting my hosted version of the bot (the one with the invite link here) to 100 servers. If you are unable to invite my instance of the bot to your server, you may try the self-hosting instructions below.
- If you have any questions or need to reach out to me, please fill out the contact form on
my website, email the email listed on my
GitHub profile, or add me on Discord
@driedsponge.
Note
As you can see from the repository, this bot was written in Java. Any attempt to run this bot requires Java 21, or any later version.
Environment Variables
There are certain variables required for the operation of the bot. Below is a description of each one. Where each one is set depends on how you decide to host the bot.
This is the most important variable for the bot. This is how the bot connects to the Discord API in order to play music to people in calls. Here is how you can get your token:
- Go to the Discord Developer Portal.
- Click on the
New Applicationbutton on the top right. - Give your application a name and click
Create. - You will be redirected to your application's page. Click on the
Bottab on the left side of the page. - Click the
Reset Tokenbutton in order to obtain your token. - Remember to keep your bot's token a secret as it can be used to control your bot. If your token
is ever exposed or compromised, you can regenerate it by clicking the
Reset Tokenbutton. - On this page you can also customize your bots profile picture, banner, and username to your liking.
- While you are on this page, please enable the
Server Members IntentandMessage Content Intent. - To generate the invite link, navigate to the
OAuth2tab, scroll to the URL generator, and selectbot. Now you can enable the following permission:Read Messages/View Channels,Send Messages,Send Messages In Threads,Connect, andSpeak. - Make sure the
Integration Typeis set toGuild Install - You can open the generated URL in your browser to invite the bot to your server. Save this URL for later if you plan on inviting the bot to other servers.
This is where you put your Discord ID. This variable will allow you to use the owner commands associated with the bot. Here is how you can obtain it:
- Open your Discord client.
- Open settings and navigate to advanced.
- Enable "Developer Mode".
- Exit settings, click on your username in the bottom left, and click
Copy User ID.
This one is pretty simple. It's just an integer that indicates the maximum amount of songs that can put into a queue per server. It must be a positive whole number or there will be issues with trying to use the bot (I would recommend 500). If you set the value to 0, the max amount of songs will be infinite.
These variables are not required but necessary if you want to support Spotify playlist, as the bot uses the Spotify web API to fetch playlist data;
If you do not plan on needing Spotify support, please set both of these variables to null.
Steps To Obtain Spotify API Credentials
- Visit the Spotify Developer Dashboard.
- Log in with your Spotify account. If you don't have a Spotify account, you'll need to create one.
- Once you're logged in, click on the
Create appbutton. - You'll be asked to enter a name for your app and a description. Fill in these fields with appropriate information.
- You will also be asked to supply a redirect URL, just put
http://localhost. - For API/SDKs, select
Web API. - Once you have crated your app, click
Settingsin the top right, and underBasic Informationyou will see your Client ID and a button that saysView client secret. Those are the credentials you will need. - Remember to keep your Client ID and Client Secret confidential. If your Client Secret gets compromised, you can regenerate it from the app's dashboard.
Hosting Without Docker (Easy)
- Head to the releases page and download the latest jar artifact from the most recent release.
- In addition, download the corresponding script file from the release page.
- If you are on Windows, download
start.bat. - If you are on Mac/Linux, download
start.sh.
- If you are on Windows, download
- Move the jar and the executable to a folder on your system. It does not matter where the folder is located, as long both files are together.
- Double-click the executable (the sh/bat file) to start the bot. It will crash the first time around, but it should
generate a
config.json. - Open the
config.jsonfile, and set the variables inside to the environment variables you have from the previous section. - Finally, double-click the executable one more time to start the bot. If everything was configured
correctly, it should be running, and you should be able to use the commands. If you are encountering
any issues, check the
freddy.logfile for errors. If you cannot resolve your issue, create a new issue on GitHub. - You might get messages from your operating system saying that the file is "not safe" because it is not from a verified developer. There is no way for me to stop these messages, but I can guarentee everything from this repository is safe. If you do not believe me, feel free to download the source code and compile the application yourself.
Hosting With Docker (Advanced)
These instructions assume you already have docker installed on your system, and you have some technical knowledge. If these instructions don't make sense, use the above guide.
- Download the code by cloning it with git or downloading the zip from GitHub.
git clone https://github.com/jortuck/Freddy.git
- Move the cloned folder to any desired location on your computer.
- Make a copy of the
settings.example.envand rename it tosettings.env. Once you have done this, opensettings.envand fill in the environment variables from the earlier instructions. - After you have done this, you can run
docker compose up --buildto start the bot. - The
Dockerfileis also included in the repository. While there is no hosted image, feel free to make your own build.