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

blue.ts

v1.3.2

Published

A simple but effective lavalink client developed in node.js

Downloads

350

Readme

Features

  • Audio playback fully featured controls.
  • Filters support.
  • Best search engines: (Youtube, Spotify, Soundcloud).
  • Autoplay feature.
  • Faster, simple and stable client.
  • Supports latest Lavalink version: 4.0.4.
  • Compatible with discord.js, eris, oceanicjs.
  • Plugins support.

Requirements

  • Node Version: >= 16.9.0
  • A Lavalink server, here are some free lavalink server: Click Me
  • Discord Bot token to get started.

Installation

# npm add
npm install blue.ts
# yarn add
yarn add blue.ts

Quick Start With Djs 13

const { Client, Intents } = require("discord.js");
const { Blue, Events, Types, Library } = require("blue.ts");

const client = new Client({
  failIfNotExists: false,
  allowedMentions: {
    parse: ['roles', 'users'],
    repliedUser: false,
  },
  partials: [
    'MESSAGE',
    'CHANNEL',
    'REACTION',
    'GUILD_MEMBER',
    'USER'
  ],
  intents: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MEMBERS,
    Intents.FLAGS.GUILD_BANS,
    Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
    Intents.FLAGS.GUILD_INTEGRATIONS,
    Intents.FLAGS.GUILD_WEBHOOKS,
    Intents.FLAGS.GUILD_INVITES,
    Intents.FLAGS.GUILD_VOICE_STATES,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
    Intents.FLAGS.GUILD_MESSAGE_TYPING,
    Intents.FLAGS.DIRECT_MESSAGES,
    Intents.FLAGS.DIRECT_MESSAGE_REACTIONS,
  ],
  presence: {
    activities: [
      {
        name: 'Blue.js',
        type: "LISTENING",
      },
    ],
    status: 'online',
  }
});

const nodes = [
  {
    host: "localhost",
    port: 2333,
    password: "youshallnotpass",
    secure: false
  }
];

const options = {
  spotify: {
    client_id: "CLIENT_ID",  //spotify client ID
    client_secret: "CLIENT_SECRET" //spotify client Secret
  },
  autoplay: true,
  version: "v4",
  library: Library.DiscordJs
};
client.manager = new Blue(nodes, options);

client.on("ready", async () => {
  console.log("Client is ready!");
  client.manager.init(client);
});

client.manager.on(Events.nodeConnect, (a, b) => {
  console.log(b);
});

client.manager.on(Events.nodeDisconnect, (a, b) => {
  console.log(b);
});

client.manager.on(Events.trackStart, async(a, b) => {
   const guild = await client.guilds.fetch(a.guildId).catch(() => null);
   if(!guild) return;
   const channel = await guild.channels.fetch(a.textChannel).catch(() => null);
   if(!channel) return;
   return channel.send(`Track Started: [${b.title}](${b.uri})`);
});

//logging
/*
client.manager.on(Events.api, (data) => {
  console.log(data);
});*/

client.on("messageCreate", async (message) => {
  if (message.author.bot || !message.guild || !message.channel) return;

  const prefix = ">";
  let player = client.manager.players.get(message.guild.id);

  if (!message.content.toLowerCase().startsWith(prefix)) return;

  const args = message.content.slice(prefix.length).trim().split(/ +/);
  const cmd = args.shift()?.toLowerCase();

  if (cmd == "play") {
    if (!message.member?.voice.channel) return message.reply("you must be in a voice channel");

    const query = args.slice(0).join(" ");

    if (!query) return message.reply("provide the query");

    if (!player)
      player = await client.manager.create({
        voiceChannel: message.member.voice.channel.id,
        textChannel: message.channel.id,
        guildId: message.guild.id,
        selfDeaf: true,
        selfMute: false
      });

    const res = await client.manager.search({ query: query }, message.author).catch(() => null);
    if (!res) return message.reply("song not found");
    if (res.loadType == Types.LOAD_SP_ALBUMS || res.loadType == Types.LOAD_SP_PLAYLISTS) {
      player.queue.add(...res.tracks);
    } else {
      player.queue.add(res.tracks[0]);
    }
    if (!player.queue?.current)
      player.play();
    return message.reply("queued song");
  }

  if (cmd == "skip") {
    if (!player || !player.isConnected) return message.reply("player not initialized yet.");
    if (player.queue.size() < 1 && !player.playing) {
      player.disconnect();
      return message.reply("there's no song to skip.");
    }
    player.stop();
    return message.reply("skipped to the next song.");
  }

  if (cmd == "stop") {
    if (!player || !player.isConnected) return message.reply("player not initialized yet.");
    player.disconnect();
    return message.reply("stopped the song, and left the vc");
  }

  if (cmd == "replay") {
    if (!player || !player.queue.current) return message.reply("Nothing playing rn.");
    player.seek(0);
    return message.reply("alr playing from the beginning.");
  }

  if (cmd == "seek") {
    if (!args[0]) return message.reply("provide the position");
    if (!player || !player.queue.current) return message.reply("Nothing playing rn.");
    player.seek(args.slice(0).join(" "));
    return message.reply("alr player position sets to " + player.position);
  }

  if (cmd == "8d") {
    if (!player || !player.queue.current) return message.reply("Nothing playing rn.");
    if(player.filter.is8D)
      player.filter.set8D(false);
    else
      player.filter.set8D(true);
    return message.reply(`filter has been added`);
  }
  
  if (cmd == "clear") {
    if (!player || !player.queue.current) return message.reply("Nothing playing rn.");
    player.filter.clearFilters();
    return message.reply(`filters has been cleared`);
  }
});

client.login("TOKEN");

Documentation

Check out the documentation for detailed usage instructions and examples.

Issues

For any inquiries or issues, feel free to open an issue on GitHub.

License

This project is licensed under the ISC License.

By Rapture