andesite.js
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

andesitejs

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

Readme

Keywords

none

Package Sidebar

Install

npm i andesite.js

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

69.9 kB

Total Files

12

Last publish

Collaborators

  • the2dperson