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

@necord/lavalink

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@necord/lavalink

A implementation of lavalink-client for Necord

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Necord Logo

🎵 A implementation of lavalink-client for Necord

Documentation ✨Source code 🪡Examples 🛠️Community 💬

NPM Version NPM License NPM Downloads Last commit

About

Transform your bot into a professional DJ with the power of the Lavalink ecosystem. This package uses lavalink-client behind the scenes, providing a high-performance and efficient solution for managing audio streams on Discord. By leveraging Lavalink, your bot gains the ability to manage audio playback, queues, and real-time controls with minimal latency, transforming it into a fully capable and professional music system.

Installation

Node.js 18.0.0 or newer is required.

$ npm i @necord/lavalink necord discord.js
$ yarn add @necord/lavalink necord discord.js
$ pnpm add @necord/lavalink necord discord.js

Usage

Once the installation process is complete, we can import the NecordLavalinkModule into the root AppModule:

import { NecordLavalinkModule } from '@necord/lavalink';
import { Module } from '@nestjs/common';
import { Client } from 'discord.js';
import { AppUpdate } from './app.update';

@Module({
    imports: [
        NecordLavalinkModule.forRoot({
            nodes: [
                {
                    authorization: 'youshallnotpass',
                    host: 'localhost',
                    port: 2333,
                    id: 'main_node'
                }
            ]
        })
    ],
    providers: [AppUpdate]
})
export class AppModule {
}

Then create app.update.ts file and add OnLavalinkManager/OnceLavalinkManager decorators for handling LavalinkManager events and OnNodeManager/OnceNodeManager decorators for handling NodeManager events:

import { Injectable, Logger } from '@nestjs/common';
import { Context } from 'necord';
import { OnLavalinkManager, OnNodeManager, LavalinkManagerContextOf, NodeManagerContextOf } from '@necord/lavalink';

@Injectable()
export class AppUpdate {
    private readonly logger = new Logger(AppUpdate.name);

    @OnNodeManager('connect')
    public onReady(@Context() [node]: NodeManagerContextOf<'connect'>) {
        this.logger.log(`Node: ${node.options.id} Connected`);
    }

    @OnLavalinkManager('playerCreate')
    public onPlayerCreate(@Context() [player]: LavalinkManagerContextOf<'playerCreate'>) {
        this.logger.log(`Player created at ${player.guildId}`);
    }
}

Whenever you need to handle any event data, use the Context decorator.

If you want to fully dive into Necord, check out these resources:

  • Necord Wiki - Official documentation of Necord.
  • Nest JS - A progressive framework for creating well-architectured applications.
  • Discord JS - The most powerful library for creating bots.
  • Discord API - Official documentation of Discord API.
  • Lavalink - Official Lavalink documentation.
  • lavalink-client - Easy, flexible and feature-rich lavalink@v4 Client.

Backers

Stay in touch

License

MIT © Alexey Filippov

Keywords

FAQs

Package last updated on 04 Oct 2024

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