| title | description |
|---|---|
Quickstart |
Get started with Aqualink - the powerful Discord Lavalink wrapper |
Set up Aqualink and start building music bots with enhanced Lavalink functionality.
Install Aqualink in your Node.js project using your preferred package manager:```bash
npm install aqualink
# or
yarn add aqualink
# or
pnpm add aqualink
```
1. Download the latest Lavalink.jar from [GitHub releases](https://github.com/lavalink-devs/Lavalink/releases)
2. Create an `application.yml` configuration file
3. Start your Lavalink server: `java -jar Lavalink.jar`
<Tip>Make sure your Lavalink server is running before initializing Aqualink!</Tip>
```javascript
const { Client, GatewayIntentBits } = require('discord.js');
const { Aqua } = require('aqualink');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages
]
});
client.aqua = new Aqua(client, {
nodes: [{
host: 'localhost',
port: 2333,
auth: 'youshallnotpass',
ssl: false
}]
});
client.on('ready', async () => {
await client.aqua.init(client.user.id);
console.log('Bot is ready and connected to Lavalink!');
});
client.login('YOUR_BOT_TOKEN');
```
```javascript
const { Aqua } = require('aqualink');
const aqua = new Aqua(client, {
nodes: [{
host: 'localhost',
port: 2333,
auth: 'youshallnotpass',
ssl: false,
name: 'main-node'
}],
defaultSearchPlatform: 'ytsearch',
nodeResolver: 'LeastLoad'
shouldDeleteMessage: false,
leaveOnEnd: true,
restVersion: 'v4',
plugins: [],
autoResume: false,
infiniteReconnects: false,
failoverOptions: {
enabled: true,
maxRetries: 3,
retryDelay: 1000,
preservePosition: true,
resumePlayback: true,
cooldownTime: 5000,
maxFailoverAttempts: 5
}
});
```
<Tip>The failover options provide robust error handling and automatic reconnection!</Tip>
// Create a player connection
const player = client.aqua.createConnection({
guildId: interaction.guild.id,
textChannel: interaction.channel.id,
voiceChannel: interaction.member.voice.channel.id,
deaf: true,
defaultVolume: 100
});
// Search and play a track
client.on('interactionCreate', async (interaction) => {
if (interaction.commandName === 'play') {
const query = interaction.options.getString('song');
const results = await player.search(query);
if (results.tracks.length > 0) {
await player.play(results.tracks[0]);
interaction.reply(`Now playing: ${results.tracks[0].title}`);
} else {
interaction.reply('No tracks found!');
}
}
});Explore Aqualink's powerful features for Discord music bots:
Learn how to create, manage, and control music players. Implement playlists and queue management for your bot. Add effects like bass boost, nightcore, and more to audio. Handle player events and create responsive music experiences.Aqualink provides enhanced functionality over standard Lavalink clients:
- Easy-to-use API with intuitive methods and properties
- Built-in queue management with shuffle, loop, and skip functionality
- Advanced search supporting YouTube, Spotify, SoundCloud, and more
- Audio filters for dynamic sound modification
- Event-driven architecture for responsive bot behavior
- TypeScript support with full type definitions