1.0.2 • Published 3 years ago

andesite.js v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

andesitejs

A feature-rich andesite client.

Support Server Github Documentation

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

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago