npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

discord-player-clone

v2.4.7

Published

Complete framework to facilitate music commands using discord.js v12

Downloads

9

Readme

Discord Player

downloadsBadge versionBadge patreonBadge

Note: this module uses recent discordjs features and requires discord.js version 12.

Discord Player is a powerful Node.js module that allows you to easily implement music commands. Everything is customizable, and everything is done to simplify your work without limiting you! It doesn't require any api key, as it uses scraping.

Installation

npm install --save discord-player

Install @discordjs/opus:

npm install --save @discordjs/opus

Install FFMPEG and you're done!

Features

🤘 Easy to use!
🎸 You can apply some cool filters (bassboost, reverse, 8D, etc...)
🎼 Manage your server queues with simple functions (add songs, skip the current song, pause the music, resume it, etc...)!
🌐 Multi-servers support

Getting Started

Here is the code you will need to get started with discord-player. Then, you will be able to use client.player everywhere in your code!

const Discord = require("discord.js"),
client = new Discord.Client(),
settings = {
    prefix: "!",
    token: "Your Discord Token"
};

const { Player } = require("discord-player");
// Create a new Player (you don't need any API Key)
const player = new Player(client);
// To easily access the player
client.player = player;

client.on("ready", () => {
    console.log("I'm ready !");
});

client.on("message", async (message) => {

    const args = message.content.slice(settings.prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();

    // !play Despacito
    // will play "Despacito" in the member voice channel

    if(command === "play"){
        let track = await client.player.play(message.member.voice.channel, args[0], message.member.user.tag);
        message.channel.send(`Currently playing ${track.name}! - Requested by ${track.requestedBy}`);
    }

});

client.login(settings.token);

Documentation

You will find many examples in the documentation to understand how the package works!

Methods overview

You need to init the guild queue using the play() function, then you are able to manage the queue and the music using the following functions. Click on a function name to get an example code and explanations.

Queue initialization

Queue management

Manage tracks in your queue

Manage music stream

Event messages

// Play the music
await client.player.play(message.member.voice.channel, "Despacito")

// Then add some messages that will be sent when the events will be triggered
client.player.getQueue(message.guild.id)
.on('end', () => {
    message.channel.send('There is no more music in the queue!');
})
.on('trackChanged', (oldTrack, newTrack) => {
    message.channel.send(`Now playing ${newTrack.name}...`);
})
.on('channelEmpty', () => {
    message.channel.send('Stop playing, there is no more member in the voice channel...');
});

Examples of bots made with discord-player

These bots are made by the community, they can help you build your own!