Skip to content

Getting Started

Installation

stable version:

Terminal window
npm install aoijs.lavalink

development version:

Terminal window
npm install tyowk/aoijs.lavalink

Configuration

The setup is used to initialize the bot client and configure the Lavalink music system. aoi.js is the main client framework, and aoijs.lavalink is an integration that allows you to connect to a Lavalink server to stream music.

1
const { AoiClient } = require('aoi.js');
2
const { Manager } = require('aoijs.lavalink');
3
4
const client = new AoiClient({
5
/* ••• */
6
});
7
8
const voice = new Manager(client, {
9
nodes: [
10
{
11
name: 'my lavalink node',
12
host: 'yourdomain.com',
13
port: 0000,
14
auth: 'youshallnotpass',
15
secure: false
16
}
17
]
18
});

Options

Options who have a leading question mark (?) are optional and not required, however if you want to use them, make sure to remove it!

1
new Manager(<AoiClient>, {
2
nodes: [{
3
name: string,
4
host: string,
5
port: number,
6
auth: string,
7
secure: boolean
8
},{ /* add more node */ }],
9
10
maxQueueSize?: number,
11
maxPlaylistSize?: number,
12
maxHistorySize?: number,
13
searchEngine?: string,
14
debug?: boolean,
15
defaultVolume?: number,
16
maxVolume?: number,
17
noLimitVolume?: boolean,
18
deleteNowPlaying?: boolean,
19
playlist?: {
20
enable: boolean,
21
table: string,
22
database?: unknown,
23
maxSongs?: number,
24
maxPlaylist?: number
25
}
26
});

Default Options

OptionTypeDefaultDescription
nodesNode[]-(see below)
playlist?Playlist-(see below)
maxQueueSize?number100Maximum number of tracks that can be queued for playback.
maxPlaylistSize?number100Maximum number of tracks that can be in a playlist.
maxHistorySize?number100Maximum number of tracks that can be saved in the history.
searchEngine?stringyoutubeDefault search engine. You can set this to ‘soundcloud’ or ‘spotify’ or others.
debug?booleanfalseWhether to enable debug logs for the music client.
defaultVolume?number100Set default volume when the player created.
maxVolume?number200Maximum volume player can handle.
noLimitVolume?booleanfalseWhether to enable no limit volume (not recommended).
deleteNowPlaying?number200Whether to enable auto-delete now playing message when track ends.

Node Options

OptionTypeDescription
name?stringcustom name for the Lavalink node (can be any string)
hoststringURL to your Lavalink node. Replace with your actual Lavalink server URL.
portnumberYour lavalink server port.
authbooleanAuthentication password for the Lavalink node.
securebooleanSet to true if your Lavalink server uses SSL/TLS (HTTPS).

Playlist Options

OptionTypeDescription
enablebooleanWhether to enable playlist feature or not.
tablestringName of the database table to store playlists.
maxSongs?numberMaximum number of songs allowed in a single playlist. (default is 20)
maxPlaylist?numberMaximum number of playlist allowed per user. (default is 10)
database?unknownReference to the database instance

see here for more client options.