andesite.js
v1.0.2
Published
A feature-rich andesite wrapper.
Downloads
6
Readme
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
- manually send voice state updates via PlayerManagerOptions#send
- provide voice server/state updates received through the discord gateway.
- 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