Coder Social home page Coder Social logo

discord.js-music's Introduction

Discord.js Music Plugin

alt text

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:

  1. npm install discord.js // The core discord.js framework.
  2. npm install ffmpeg-binaries // Gives your ability the bot to hear (required to join vc)
  3. npm install node-opus or npm install opusscript // Required to stream audio, node-opus recommended

Installation:

  1. 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.

  1. Download and install Visual Studio 2015
  2. New project -> Visual C++
  3. Install Visual C++

If that doesn't fix your issue;

  1. 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, {
	prefix: '-',        // Prefix of '-'.
	global: false,      // Server-specific queues.
	maxQueueSize: 10,   // Maximum queue size of 10.
	clearInvoker: true, // If permissions applicable, allow the bot to delete the messages that invoke it (start with prefix)
    channel: 'music'    // Name of voice channel to join. If omitted, will instead join user's voice channel.
});
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.
 *      channel: Name of voice channel to join. If omitted, will instead join user's voice channel.
 */
music(client, options);

discord.js-music's People

Contributors

amraki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.