Getting Started
Installation
stable version:
npm install aoijs.lavalink
development version:
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.
1const { AoiClient } = require('aoi.js');2const { Manager } = require('aoijs.lavalink');3
4const client = new AoiClient({ /* ••• */ });5
6const voice = new Manager(client, {7 nodes: [{8 name: 'my lavalink node',9 host: 'yourdomain.com',10 port: 0000,11 auth: 'youshallnotpass',12 secure: false13 }]14});
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!
1new Manager(<AoiClient>, {2 nodes: [{3 name: string,4 host: string,5 port: number,6 auth: string,7 secure: boolean8 },{ /* 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?: number25 }26});
Default Options
Option | Type | Default | Description |
---|---|---|---|
nodes |
Node[]
|
- | (see below) |
playlist? |
Playlist
|
- | (see below) |
maxQueueSize? | number |
100 | Maximum number of tracks that can be queued for playback. |
maxPlaylistSize? | number |
100 | Maximum number of tracks that can be in a playlist. |
maxHistorySize? | number |
100 | Maximum number of tracks that can be saved in the history. |
searchEngine? | string |
youtube | Default search engine. You can set this to ‘soundcloud’ or ‘spotify’ or others. |
debug? | boolean |
false | Whether to enable debug logs for the music client. |
defaultVolume? | number |
100 | Set default volume when the player created. |
maxVolume? | number |
200 | Maximum volume player can handle. |
noLimitVolume? | boolean |
false | Whether to enable no limit volume (not recommended). |
deleteNowPlaying? | number |
200 | Whether to enable auto-delete now playing message when track ends. |
Node Options
Option | Type | Description |
---|---|---|
name? | string |
custom name for the Lavalink node (can be any string) |
host | string |
URL to your Lavalink node. Replace with your actual Lavalink server URL. |
port | number |
Your lavalink server port. |
auth | boolean |
Authentication password for the Lavalink node. |
secure | boolean |
Set to true if your Lavalink server uses SSL/TLS (HTTPS). |
Playlist Options
Option | Type | Description |
---|---|---|
enable | boolean |
Whether to enable playlist feature or not. |
table | string |
Name of the database table to store playlists. |
maxSongs? | number |
Maximum number of songs allowed in a single playlist. (default is 20) |
maxPlaylist? | number |
Maximum number of playlist allowed per user. (default is 10) |
database? | unknown |
Reference to the database instance |
see here for more client options.