This version is not yet stable, although has been mildly tested, it has not been that extensive. It's an update of the original by ruiqimao for Discord.js's version v11.x, and adds a few extra sprinkles. It still requires tweaks and testing but yeah it's something.
It adds:
skip
to the person who added the request, and music managersresume
, pause
, and volume
to music managersThings to do:
musicManager
into an object to contain and support multiple guilds.Things left to test:
Known Issues:
Installation:
npm install
This is a music plugin for Discord.js. Using it is as easy as:
const Client = require('discord.js').Client;
const music = require('./path/to/this/project');
const client = new Client();
music(client);
client.login('< bot token here >');
The module consists of a single function, which takes two arguments:
/*
* Initialize the music plugin.
*
* @param client The Discord.js client.
* @param options (Optional) A
*/
music(client, options);
Options:
prefix
The prefix to use for the command (default '!').global
Whether to use the same queue for all servers, instead of server-specific queues (default false).maxQueueSize
The maximum queue size (default 20)volume
The volume to start playback at (default 50 [0.5])anyOneCanSkip
Allow anyone to skip a track (if disabled, only the music managers + the person who added can skip). (default false).clearInvoker
Have the bot remove messages which invoke, these are the one that start with the prefix provided. (default false)autoJoin
An array containing voice channel ids to automatically join.musicChannels
An array containing text channel ids where the bot can be used. Note: adding one will limit globally, so be sure to add one per-server.allowSearch
If searching on YouTube should be allowed. (default true)youtube
(REQUIRED) your YouTube API key. (We strongly recommend storing this in Auth)yt
An object containing YouTube configuration optionsYouTube Configuration Options:
safeSearch
can be none
, moderate
or strict
. Defines parental filters (default 'none')videoDefinition
can be any
, standard
or high
. Will define what quality of videos should be searched (default 'any')videoDuration
can be any
, short
, medium
or long
.
any – Do not filter video search results based on their duration. This is the default value.
long – Only include videos longer than 20 minutes.
medium – Only include videos that are between four and 20 minutes long (inclusive).
short – Only include videos that are less than four minutes long.
How to add "Music Managers"
musicManager: {
'<server id>': '<role name>'
},
How to add auto join channels
autoJoin: [
'<channel id>' // My Server Name (for reference)
]
How to restrict bot to only be invoked from certain channels
musicChannels: [
'<channel id>' // My Server Name (for reference)
]
How to get server id?
SERVER ID
. How to get channel ids?
What permissions do the roles need?
The commands available are:
play <url>
: Play a video/music. It can take a URL from various services (YouTube, Vimeo, YouKu, etc). Search has been removed temporally until a workaround can be found.skip [number]
: Skip some number of songs. Will skip 1 song if a number is not specified.queue
: Display the current queue.pause
: Pause music playback. (requires music manager)resume
: Resume music playback. (requires music manager)volume
: Adjust the playback volume between 1 and 200 (requires music manager)