Giter Site home page Giter Site logo

stegripe / icelink Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 489 KB

Esbatu surpasses Lavalink with superior stability, frequent updates, extended capabilities, and efficient Redis caching, offering a reliable music streaming experience.

License: GNU Affero General Public License v3.0

TypeScript 98.24% JavaScript 1.76%

icelink's Introduction

Esbatu

Esbatu surpasses Lavalink with enhanced stability, frequent updates, and support for ESM and CommonJS, offering a superior audio streaming experience. It features new handling mechanisms and uses Redis to manage current song/session resources, preventing replay issues.

NPM version NPM downloads Tests status

Installation

Node.js 18 or newer is required.

npm install esbatu # npm
pnpm add esbatu # pnpm
yarn add esbatu # yarn
bun add esbatu # bun

Example usage

Create class extends Esbatu for depending on your library implementation (like discord.js):

import { Esbatu } from "esbatu";

export class extends Esbatu {
    constructor(client, options) {
        super(options);

        this.client = client;
    }

    sendPacket(shardId, payload, important) {
        return this.client.ws.shards.get(shardId)?.send(payload, important);
    }
}

Afterwards we can create a quite simple example:

import { Client } from "discord.js";
import { Esbatu } from "./Esbatu.js";

const client = new Client({
    intents: ["Guilds", "GuildMembers", "GuildVoiceStates", "GuildMessages"]
});

client.esbatu = new Esbatu(client, {
    nodes: [
        {
            name: "default",
            url: "localhost:2333",
            authorization: "youshallnotpass"
        }
    ]
});

client.esbatu.on("error", (_, error) => console.error(error));
client.on("raw", packet => client.esbatu.updateInstance(packet));
client.on("ready", async () => {
    client.esbatu.id = client.user.id;

    for (const node of client.esbatu.options.nodes)
        client.esbatu.addNode(node).catch(error => client.esbatu.emit("error", node.name, error));

    const node = client.esbatu.idealNode;
    const player = await node.joinVoiceChannel({
        guildId: "972407605295198258",
        channelId: "972421158664298506",
        shardId: 0
    });

    const resultTrack = await player.node.rest.resolve("https://youtu.be/caryNKvasJI");

    await player.playTrack({
        track: resultTrack.data.encoded
    });

    setTimeout(async () => {
        await client.esbatu.leaveVoiceChannel(player.guildId);
    }, 60_000);
});

client.login("token");

icelink's People

Contributors

renovate[bot] avatar fab1o0107 avatar mzrtamp avatar

Stargazers

 avatar Fyphen avatar Syah Warid Ghani Akram avatar  avatar Orchitiadi Ismaulana Putra avatar

Watchers

Hereza Liem avatar

icelink's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Fallback to renovate.json file as a preset is deprecated, please use a default.json file instead.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release.yaml
  • stegripe/workflows main
.github/workflows/test.yaml
  • stegripe/workflows main
nodenv
.node-version
  • node 20
npm
package.json
  • discord-api-types ^0.37.93
  • lavalink-api-types ^2.0.2
  • undici ^6.19.7
  • ws ^8.18.0
  • @stegripe/eslint-config ^1.0.1
  • @types/node ^20.14.15
  • @types/ws ^8.5.12
  • cross-env ^7.0.3
  • eslint ^9.9.0
  • eslint-formatter-pretty ^6.0.1
  • eslint-plugin-prettier ^5.2.1
  • prettier ^3.3.3
  • tsup ^8.2.4
  • typedoc ^0.26.5
  • typescript ^5.5.4
  • ioredis >=5.4.1
nvm
.nvmrc

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.