Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

lavaclient/andesite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A feature-rich andesite client.

Support ServerGithubDocumentation

Installation

npm install --save andesite.js

or yarn

yarn add andesite.js

Example

You must

  1. manually send voice state updates via PlayerManagerOptions#send
  2. provide voice server/state updates received through the discord gateway.
  3. initialize the manager with your client's user id as the first parameter.
import { PlayerManager } from "andesite.js";

const manager = new PlayerManager({
  nodes: [ { host: "localhost", port: 5000 } ],
  send: (id, payload) => sendPayloadToGateway(id, payload)
});

await manager.init("client id")
await manager.stateUpdate(discordStateUpdate)
await manager.serverUpdate(discordServerUpdate)
Example Command Usage.
const player = manager.createPlayer(guild.id)
  .connect(voiceChannel);

const query = /^https?:\/\//im.test(message.content)
  ? message.content
  : `ytsearch:${message.content}`;

const { tracks } = await player.node.rest.loadTracks(query);
if (!tracks) {
  return channel.send(`Nothing found for: ${message.content}`);
}

await player.filters.setTimescale({ pitch: 1.2, rate: 1.1 }); // nightcore-esque
await player.playTrack(tracks[0]);
Player Transports

As described in andesite's API documentation, you can control a player via the websocket or with the REST API.

manager.createPlayer("guild id", {
  transport: "rest", // can be "websocket" or "rest", defaults to "websocket"
  ...
});

lavaclient © 2020 - 2021

About

Fully-featured andesite client.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published