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-yt-player

v1.1.1

Published

Fully Automated Music Bot for the Discord Servers Edit

Downloads

14

Readme

discord-yt-player

Fully Automated Music Bot for the Discord Servers

alt text

Getting Started

These instructions will get you a copy of the project up and running on your local machine.

Prerequisites

What things you need to install the software and how to install them

npm install discord.js
npm install ytdl-core
npm install request

Installing

A step by step series of examples that tell you have to get a development env running

Download discord-yt-player.js and declare it

const DM = require('discord-yt-player')

Setup & Options

First of all you need to create a Discord client object e.g.

const client = new Discord.Client({
    autoReconnect: true, 
    max_message_cache: 0
});

Next up create a bot object based on the client

const bot = new DM.DiscordMusic(client);

Simple settings and setup

bot.setup({
    token_key: '', // Individual App Bot User Token
    server_id: '', // Server ID
    channels: {
        voice_channel_id: '', // Voice Channel ID
        text_channel_id: '' // Text Channel ID
    },
    yt_api_key: '' // Youtube Api Key
});

or you can use much more simpler version dedicated for command line

bot.setup({
    token_key: process.argv[2], // Individual App Bot User Token
    server_id: process.argv[3], // Server ID
    channels: {
        voice_channel_id: process.argv[4], // Voice Channel ID
        text_channel_id: process.argv[5] // Text Channel ID
    },
    yt_api_key: process.argv[6] // Youtube Api Key
});

and simply run it

node YOUR_APP.js <TOKEN> <SERVER_ID> <VOICE_CHANNEL_ID> <TEXT_CHANNEL_ID> <YOUTUBE_API_KEY>

Available commands list: (default names)

  • songrequest [youtube-url]: Adds new YouTube song to the queue
  • skip: Skips a song //TO-DO List
  • queue: Displays all songs in queue //TO-DO List
  • stop: Stops music playback. //TO-DO List
  • start: Resumes music playback. //TO-DO List
  • clear: Clears queue. //TO-DO List

alt text

Running the tests

Force add songs to the queue

setTimeout(function() {

  if(bot.isConnected) {
    bot.listing(
    "YOUTUBE_VIDE_URL_1", 
    "YOUTUBE_VIDE_URL_2",
    "YOUTUBE_VIDE_URL_3",
    "YOUTUBE_VIDE_URL_4");
  } else {
    console.log("not connected");
  }
  
}, 3000);

Built With

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • This is a very simple project of script in node.js, made for purposes of trying new things in ES6.