Skip to content

ToddyTheNoobDud/Salad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Salad

License: WTFPL Python Code style: black Discord

Salad is a lightning-fast, completely asynchronous Python framework designed for effortless Lavalink integration with discord.py. With full Lavalink specification support, clean API architecture, and robust integrated Spotify and Apple Music functionality, Salad enables creators to craft outstanding music bots effortlessly.

Developed as an improved fork of AquaLink, Salad provides enhanced performance and developer satisfaction.

Essential Resources

Setup Instructions

Requires Python 3.8 or newer and current pip version.

Production Version (Suggested)

pip install salada

Unstable version of Salad.

pip install git+https://github.com/ToddyTheNoobDud/salad

Quick Start Guide

Browse detailed examples in the examples folder

Here's a basic starter code:

import discord
from discord.ext import commands
from discord import app_commands
from salada import Salad

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

NODES = [{
    'host': '127.0.0.1',
    'port': 50166,
    '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.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}**')

bot.run('putyourtokenhere.')

Common Questions

How do I configure Lavalink initially?

  • To configure Lavalink look Here For plugins look Here

What skills do I need to use Salad?

  • Salad requires you have a little experience with python and discord.py

My application can't locate the Salad package. What should I do?

  • This means you don't have Salad installed, To install it run: pip install salada and check if it's installed by doing pip freeze and searching for salada.

Why should I choose Salad over alternative Lavalink packages?

  • Salad has a wide variety of features to use aswell as enableReconnect, infiniteReconnect, maxReconnectAttempts and autoplay coming soon.

Acknowledgments

Appreciation to southctrl for creating filters and enums!

About

An "Fork" of aqualink made in python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages