Skip to main content

Get started with Salada in three steps

Set up Salada and start building music bots with enhanced Lavalink functionality.

Step 1: Installation and Setup

Install Salada in your Python project using pip:
pip install salada

Step 2: Initialize Salada

Create your first Salada instance and connect to your Lavalink server:
import discord
from discord.ext import commands
from salada import Salad

INTENTS = discord.Intents.default()
INTENTS.message_content = True
INTENTS.voice_states = True

NODES = [{
    'host': '127.0.0.1',
    'port': 2333,
    'auth': 'youshallnotpass',
    'ssl': False
}]

class MusicBot(commands.Bot):
    def __init__(self):
        super().__init__(command_prefix='!', intents=INTENTS)
        self.salad = None
    
    async def setup_hook(self):
        self.salad = Salad(self, NODES)
        await self.salad.start(NODES, str(self.user.id))
        await self.tree.sync()

bot = MusicBot()

bot.run('YOUR_BOT_TOKEN')
For production use, here’s a full configuration with all available options:
from salada import Salad

NODES = [{
    'host': 'localhost',
    'port': 2333,
    'auth': 'youshallnotpass',
    'ssl': False,
    'name': 'main-node'
}]

self.salad = Salad(self.bot, NODES opts={
    'enableReconnect': True,
    'infiniteReconnect': True,
    'maxReconnectAttempts': 10,
    'baseReconnectDelay': 2.0,
    'maxReconnectDelay': 300.0
})
The failover options provides error handling and automatic reconnection!

Step 3: Play your first track

Here’s how to create a connection and play your first track:
from discord import app_commands

@bot.tree.command(name='play')
@app_commands.describe(query='Song name or URL')
async def play(interaction: discord.Interaction, query: str):
    await interaction.response.defer()
    
    if not interaction.user.voice:
        await interaction.followup.send('❌ Join a voice channel first!')
        return
    
    player = bot.salad.players.get(interaction.guild.id)
    if not player:
        player = await bot.salad.createConnection({
            'guildId': interaction.guild.id,
            'voiceChannel': interaction.user.voice.channel.id,
            'textChannel': interaction.channel.id
        })
        await interaction.user.voice.channel.connect()
    
    result = await bot.salad.resolve(query, requester=interaction.user)
    tracks = result.get('tracks', [])
    
    if not tracks:
        await interaction.followup.send('❌ No tracks found!')
        return
    
    track = tracks[0]
    player.addToQueue(track)
    
    if not player.playing:
        await player.play()
        await interaction.followup.send(f'▶️ Now playing: **{track.title}**')
    else:
        await interaction.followup.send(f'➕ Added: **{track.title}**')

Next steps

Explore Salada’s powerful features for Discord music bots:

Player Management

Learn how to create, manage, and control music players.

Queue System

Implement playlists and queue management for your bot.

Audio Filters

Add effects like bass boost, nightcore, and more to audio.

Events & Listeners

Handle player events and create responsive music experiences.

Key Features

Salada 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
  • Python 3.8+ support with async/await
Need help? Check out our API Reference or join our community Discord server for support and examples.