Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

poru

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poru

A stable and powefull lavalink client with so many features

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
294
increased by24.05%
Maintainers
1
Weekly downloads
 
Created
Source

Discord npm Github Stars GitHub issues Snyk Vulnerabilities for npm package NPM

Table of contents

Installation

// Using npm
npm install poru

// Using yarn
yarn add poru

About

To use you need a configured Lavalink instance.

  • Stable client
  • 100% Compatible with Lavalink
  • Object-oriented
  • 100% Customizable
  • Easy to setup

Implementation

Poru Music Example bot as guide for beginning.

Example usage basic bot

// main file
// Require both libraries
const { Client } = require('discord.js');
const { Poru } = require('poru');

// Initiate both main classes
const client = new Client();

// Define some options for the node
const nodes = [
  {
    host: 'localhost',
    password: 'youshallnotpass',
    port: 2333,
    secure: false,
  },
];

// Define if you want to integrate spotify
const spotifyOptions = {
  clientID: 'Your Client ID', // You'll find this on https://developers.spotify.com/dashboard/
  clientSecret: 'Your Client Secret', // You'll find this on https://developers.spotify.com/dashboard/
  playlistLimit: 10, // The amount of pages to load when a playlist is searched with each page having 50 tracks.
  albumLimit: 5, // The amount of pages to load when a album is searched with each page having 50 tracks.
  artistLimit: 5, // The amount of pages to load when a artist is searched with each page having 50 tracks.
  searchMarket: 'IN', // The market from where the query should be searched from. Mainly this should contain your country.
};

// Assign Manager to the client variable
client.poru = new Poru(client, nodes);

// Emitted whenever a node connects
client.poru.on('nodeConnect', node => {
  console.log(`Node "${node.name}" connected.`);
});

// Emitted whenever a node encountered an error
client.poru.on('nodeError', (node, error) => {
  console.log(`Node "${node.name}" encountered an error`);
});

// Listen for when the client becomes ready
client.once('ready', () => {
  client.poru.init(client);
  console.log(`Logged in as ${client.user.tag}`);
});

// this event used to make connections upto date with lavalink
client.on('raw', async d => await client.poru.packetUpdate(d));

// Finally login at the END of your code
client.login('your bot token here');
// creating player
const player = await client.poru.createConnection({
  guild: message.guild.id,
  voiceChannel: message.member.voice.channel.id,
  textChannel: message.channel,
  selfDeaf: true,
  selfMute: false,
});
// Getting tracks
const resolve = await client.poru.resolve('Ignite', 'yt');

Need Help?

Feel free to join our discord server, Give us suggestions and advice about errors and new features. with ❤️ by Paras .

Keywords

FAQs

Package last updated on 05 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc