A free, open-source JavaScript music bot created with discord.js
and discord-player
. Complete (45+ commands) with persistent settings, effects, filters, auto-play, DJ-roles, and so much more.
YouTube • Spotify • SoundCloud • Apple Music • Vimeo • ReverbNation • Discord Attachments
This project was created and open-sourced by Mirasaki Development. That means it's publicly available for anyone to grab and use in any way you want (MIT licensed). This project will never be monetized, every feature will always be free. All we need to keep adding new functionality and modules is some GitHub stars. Join the absolute legends below by clicking that Star button in the top-right of your screen, it doesn't cost you anything and means the world to us ❤️
- Showcase
- Features
- Demo
- Installation & Usage
- Configuration
- Discord Permissions
- Client Permissions
- Support
- Easy installation
- Settings with persistency
- 60+ total audio filters
- Multiple server support
- Vote skip
- Search, play, and lyrics autocomplete enabled
- Search play buttons
- DJ Roles
- Dedicated music channels
- Thread sessions
- Auto-play (24/7)
- Biquad filter + Equalizer
- 4 Repeat/loop modes
- Full track history
- Slash commands and modern Discord components
- Lyrics
- Volume (persistent)
- Full playback control
- with over 20 player-control commands like
/pause
/skip-to
/swap-songs
- and so much more
- Save songs by sending it to your DMs
Don't take our word for it, though. Instead, you should just see for yourself in our support server.
- FFmpeg or Avconv
- Windows: download source
- Linux: packages
- macOS: static builds
- Directly supported through Docker
- If you're having trouble installing FFmpeg, you can try ffmpeg-static, by running
npm install ffmpeg-static
- this is a last resort and not recommended
- A Discord Bot account
- Head over to the page linked above
- Click "New Application" in the top right
- Give it a cool name and click "Create"
- Click "Bot" in the left hand panel
- Click "Add Bot" -> "Yes, do it!"
- Click "Reset Token" and copy it to your clipboard, you will need it later
- NodeJS (if you're running as a plain NodeJS app)
- Head over to the download page
- Download the latest LTS build available for your OS
- Be sure to check the box that says "Automatically install the necessary tools" when you're running the installation wizard
The quickest and easiest way to host/use this bot is by deploying it inside of a Docker container.
A docker-compose file is included for your convenience
- Clone this repository:
git clone https://github.com/Mirasaki/mirasaki-music-bot.git
- Navigate inside the new folder:
cd mirasaki-music-bot
- Rename
/.env.example
to.env
and provide your environmental variables- Windows users often experience issues with this file, if you're getting errors that the env file can't be found, or
Expected path argument to be of type string
- check out this timestamped video
- Windows users often experience issues with this file, if you're getting errors that the env file can't be found, or
- (optional) Rename
/config.example.js
toconfig.js
and provide your bot configuration - Build the project:
docker build --tag my-mirasaki-music-bot .
- Start the bot:
docker run -it --env-file .env --name my-mirasaki-music-bot
You can also clone this repository or download a release, and host the project directly. You will need Node/NodeJS (Be sure to check the box that says "Automatically install the necessary tools" when you're running the installation wizard)
- Head over to the download page
- Alternatively, clone this repository by using
git clone https://github.com/Mirasaki/mirasaki-music-bot.git
and skip to step 4 if you have Git installed
- Alternatively, clone this repository by using
- Download either the
zip
orzip.gz
source code - Extract it using your favorite zip tool
- Open a new console/terminal/shell window in the newly created project folder
- Run
npm install
to install all dependencies - Rename
/.env.example
to.env
and configure your environmental variables- Windows users often experience issues with this file, if you're getting errors that the env file can't be found, or
Expected path argument to be of type string
- check out this timestamped video
- Windows users often experience issues with this file, if you're getting errors that the env file can't be found, or
- (optional) Rename
/config.example.js
toconfig.js
and go through your bot configuration - Use the command
node .
to start the application, or alternatively:npm run pm2:start
to keep the process alive in the background with PM2, suitable for production environments. (npm i -g pm2
to install)npm run start:dev
if you havenodemon
installed for automatic restarts on changes, suitable for development environments
All configuration is done in /config.js
. Multiple Discord servers are supported. The configuration file is created during the installation and usage steps. Below is detailed information on what the settings do.
{
// Note: all the default# properties all configurable by commands
// This is here so that you can configure everything in one go
// without having to figure out different commands,
// if you're not comfortable editing this, use the commands
// Note: default# properties only take affect the first time
// playback is initialized in your server/guild
// Between 0 and 100
// 100 is obnoxiously loud and will f*** your ears
defaultVolume: 5,
// The default repeat mode
// 0 - Off | Don't repeat
// 1 - Track | Repeat current track, always - until skipped
// 2 - Queue | Repeat the entire queue, finished songs get added back at the end of the current queue
// 3 - Autoplay | Autoplay recommended music when queue is empty
//
// 3 = 24/7 autoplay/continuous radio if uninterrupted - only use if you have
// bandwidth for days
defaultRepeatMode: 0,
// Amount of seconds to stay in the voice channel
// when playback is finished
// Default: 2 minutes
defaultLeaveOnEndCooldown: 120,
// Should the bot leave the voice-channel if there's no other members
defaultLeaveOnEmpty: true,
// Time amount of seconds to stay in the voice channel
// when channel is empty/no other members aside from bot
// Only active when leaveOnEmpty is true
// Default: 2 minutes
defaultLeaveOnEmptyCooldown: 120,
// When true, will create a thread when the voice session is first initialized
// and continue to send music/queue events in that thread instead of flooding
// the channel
defaultUseThreadSessions: true,
// When true, and defaultUseThreadSessions is true, will only allow commands involving
// the current session to be used in the created session Thread channel
defaultThreadSessionStrictCommandChannel: true,
// Plugins/Music source extractors
plugins: {
fileAttachments: true,
youtube: true,
soundCloud: true,
appleMusic: true,
vimeo: true,
reverbNation: true,
// To disable Spotify:
// spotify: false,
spotify: {
clientId: process.env.SPOTIFY_CLIENT_ID,
clientSecret: process.env.SPOTIFY_CLIENT_SECRET
},
},
// Bot activity
presence: {
// One of online, idle, invisible, dnd
status: 'online',
activities: [
{
name: '/play',
// One of Playing, Streaming, Listening, Watching
type: 'Listening'
}
]
},
// Permission config
permissions: {
// Bot Owner, highest permission level (5)
ownerId: '290182686365188096',
// Bot developers, second to highest permission level (4)
developers: [ '' ]
},
// The Discord server invite to your Support server
supportServerInviteLink: 'https://discord.gg/mirasaki',
// Additional permissions that are considered required when generating
// the bot invite link with /invite
permissionsBase: [
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.SendMessagesInThreads
]
}
This is not the permission level required to execute actions or run commands, like User, Moderator or Administrator
Invite the bot to your server by navigating to the following URL (replace YOUR_CLIENT_ID
with DISCORD_CLIENT_ID
from the /.env
file):
https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=0&scope=bot%20applications.commands
Any command can be used without any Discord permissions, as long as the bot is invited to your server with the bot
and applications.commands
scopes. You can use the template url above, or alternatively, generate an invite link in the Discord Developer Portal (Your App > OAuth2 > URL Generator > scopes: bot + applications.commands
)
For the bot to be able to join your Voice Channel, it will need the View Channel
, Connect
and Speak
permissions.
The bot needs the View Channel
, Send Messages
, and Embed Links
in any channel where playback is initialized to be able to send event notifications to that channel.
These are permission levels that are used internally by the bot to determine the permission level of any given user and determine which commands they can use. Available permissions levels are:
You can modify Moderators, Administrators, Developers and Bot Owners in
/config.js
, this is optional
- 0 - User - This is the default permission levels, everyone has this this - doesn't have access to any dangerous commands
- 1 - Moderator - Unused in this bot. Anyone that has the Discord permissions
Kick Members
andBan Members
is considered a Moderator - 2 - Administrator - The Administrator permission level is the highest permission level that can be assigned through Discord. Anyone with the Discord permission
Administrator
is considered an Administrator internally and will have access to powerful commands like/clear-queue
- 3 - Server Owner - This is the permission level of your Discord server owner, only 1 person can have this at any given time. Used to make sure server owners have a snowflake permission level internally 🙏 Doesn't currently have any exclusive commands, but you can choose to restrict commands to this permission level as needed
- 4 - Developer - This is for members that develop on the bot, has access to dev utilities like
/eval
and/exec
. This permission level can do almost everything, including evaluating arbitrary code on your host machine - use with caution! - 5 - Bot Owner - Bypasses every permission bit and level check, has access to every command and command.
You can modify required permission levels to execute commands in the command files by setting the permLevel property. Let's take a look at an example /src/commands/
file:
module.exports = new ChatInputCommand({
// Inside of the ChatInputCommand({
// Can be set to User, Moderator, Administrator, Server Owner, Developer, Bot Owner
// Support IntelliSense/auto-complete
permLevel: 'Administrator',
// ... other properties
run: async (client, interaction) => {
// The commands #run/execute function
}
});
Join our support server if you need any further assistance, have feature suggestion or have any other feedback
Contact me personally for legal enquiries at: [email protected]
Open source, self-hosted, and MIT licensed, meaning you're in full control.