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

buttube

v0.4.8

Published

A music package with buttons

Downloads

128

Readme

Buttube

A music package with buttons

Installation

Table of content:

- installation

- Get started

- How to use

npm:

npm i buttube

yarn:

yarn add buttube

get started

Here is how to get started

First you need to decide whether you will use a local file database or quick-mongo

Below is the line for Quic mongo

const Discord = require('discord.js');
Client = Discord.Client;
Intents = Discord.Intents;
//GUILD_VOICE_STATES intent is required
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES] });
const {buttube} = require('buttube')
client.buttube = new buttube(client, "mongodb url", embed, api)

params

client - Discord.client mongodb url - mongodb connection url embed - The setup embed api - the youtube api key used for add song to playlist function(now is shifted to this place)

OR

Below is for Local file database

const Discord = require('discord.js');
Client = Discord.Client;
Intents = Discord.Intents;
//GUILD_VOICE_STATES intent is required
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES] });
const {quickbuttube} = require('buttube')
client.buttube = new quickbuttube(client, embed, api)

params

client - Discord.client embed - The setup embed api - the youtube api key used for add song to playlist function(now is shifted to this place)

another step

//add this event
client.on('interactionCreate', async(interaction) => {
    if (!interaction.isButton()) return;
    client.buttube.interaction(interaction)
})

another step

Here you can set the embed details. eg:-

//I have not added image as the image has to be the song thumnail
//you can only set title, footer and dexcription for now.
const playembed = {
    title: 'Now playing: -song.name-',
    footer: "Song's duration: -song.duration-",
    description: 'Some description' 
}
//-song.name- : this is the name of the song
//-song.url- : this is the song url
//-song.duration- : this is the song duration
//-song.user- : the user who requested the song

add the following line in Your code anywhere:-

client.buttube.events(playembed)

how to use

here is how to create commands

play command

if(command === "play" || command === "p"){
         
        client.buttube.play(message, args.join(" "));
        //For playing your playlist the args.join(" ") should be equal to "my list". Eg: ?p my list.
    }

to make setup command

if(command === "setup" || command === "leave"){
     client.buttube.setup(message);
    }

Creating Playlist Command

if(command === "addlist" || command === "a"){
         
        client.buttube.addSongToPlaylist(message, args.join(" "));
    }

Deleting a playlist

if(command === "clearList" || command === "c"){
         
        client.buttube.clearList(message);
    }

Slash Commands

added slash commands

//set listEnabled to true if you have provided an api key else set it to false
//if listEnabled is true then please fill addList and clear command's name
client.buttube.slashCmd(client, 'client_id', {
    listEnabled: true/false, 
    playCmd: 'play command name',
    setupCmd: 'setup command name',
    addList: 'add song to playlist command name',
    songName: 'the option name which is added to the slash command',
    clear: 'clear command name'
    })        

addlist function will not work witout api key addlist slashcommand is off by default to turn it on just set the above to true and provide the youtube api key

That's it enjoy