discord.js-music-v12
v1.0.0
Published
![alt text](https://nodei.co/npm/discord.js-music-v11.png?downloads=true&stars=true "discord.js-music-v11 stats")
Downloads
37
Readme
Discord.js Music Plugin
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.
The commands available are:
play (<url>|<search string>)
: Play a video/music. It can take a URL from various services (YouTube, Vimeo, YouKu, etc). You can also search using a string.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)leave
: Clears the song queue and leaves the channel.clearqueue
: Clears the song queue.
Permissions:
- If
anyoneCanSkip
is false then only admins and the user that requested the song can skip it. - Only admins can change volume or resume/pause music.
Things added:
- Search is working again.
- Added the command 'volume'
- Added the command 'leave'
- Added the command 'clearqueue'
Things changed:
- Permissions
Pre-installation:
npm install discord.js
// The core discord.js framework.npm install ffmpeg-binaries
// Gives your ability the bot to hear (required to join vc)npm install node-opus
ornpm install opusscript
// Required to stream audio, node-opus recommended
Installation:
npm install discord.js-music-v11
Common installation issues:
Issue: FFMPEG was not found on your system, so audio cannot be played. Please make sure FFMPEG is installed and in your PATH.
Fix: npm install ffmpeg-binaries
Issue: Couldn't find an Opus engine.
Fix: npm install node-opus
or npm install opusscript
Issue: Any node-gyp errors. (build fail, missing cl.exe, etc.)
Fix: This one is a little more complicated.
- Download and install Visual Studio 2015
- New project -> Visual C++
- Install Visual C++
If that doesn't fix your issue;
- Download and install the Windows 8.1 SDK
This is a music plugin for Discord.js. Using it is as easy as:
const Discord = require('discord.js');
const music = require('discord.js-music-v11');
const Bot = new Discord.Client();
const token = "<auth_token>" // Recommended to load from json file.
Bot.on('ready', () => {
console.log(`[Start] ${new Date()}`);
});
music(Bot);
Bot.login(token);
The module consists of a single function, which takes two arguments:
/*
* @param {Client} client - The discord.js client.
* @param {object} options - (Optional) Options to configure the music bot. Acceptable options are:
* prefix: The prefix to use for the commands (default '!').
* global: Whether to use a global queue instead of a server-specific queue (default false).
* maxQueueSize: The maximum queue size (default 20).
* anyoneCanSkip: Allow anybody to skip the song.
* clearInvoker: Clear the command message.
* volume: The default volume of the player.
*/
music(client, options);