Represents a Lavalink client used to manage nodes and connections.

Overview

lavaplayer

Represents a Lavalink client used to manage nodes and connections.

setup

pip install lavaplayer

setup lavalink

you need to java 11* LTS or newer required.

install lavalink last version, create application.yml, run the server

java -jar Lavalink.jar

config lavaplayer server info

from .LavalinkClient() set information connection

host="127.0.0.1",  # server ip address
port=8888,  # port
password="password",  # password authentication
bot_id=123 # bot id

license

take to LICENSE file

Comments
  • Got  'node not found'

    Got 'node not found'

    Hi i started to use your library to play music and i got that error

    Traceback (most recent call last): File "/home/pi/.local/lib/python3.9/site-packages/lightbulb/app.py", line 1154, in invoke_application_command await context.invoke() File "/home/pi/.local/lib/python3.9/site-packages/lightbulb/context/base.py", line 292, in invoke await self.command.invoke(self) File "/home/pi/.local/lib/python3.9/site-packages/lightbulb/commands/base.py", line 544, in invoke await self(context, **kwargs) File "/home/pi/.local/lib/python3.9/site-packages/lightbulb/commands/base.py", line 459, in __call__ return await self.callback(context, **kwargs) File "/home/pi/M.A.R.I.O.N/test_bot/bot.py", line 147, in cmd_play_voice await lavalink.play(ctx.guild_id, result[0], ctx.author.id) # play the first result File "/home/pi/.local/lib/python3.9/site-packages/lavaplayer/client.py", line 295, in play raise NodeError("Node not found", guild_id) lavaplayer.exceptions.NodeError: ('Node not found', 791009507126804511)

    Here is my code

    @lightbulb.add_cooldown(15.0, 1, lightbulb.UserBucket)
    @lightbulb.add_checks(lightbulb.owner_only)
    @lightbulb.option("musique","Ce que vous souhaitez faire lire à M.A.R.I.O.N") # Option definition 1) --> the name of the option 2) --> The description of the option
    @lightbulb.command("play", "Connecter M.A.R.I.O.N")  # Command definition 1) --> the name of the command 2) --> The description of the command
    @lightbulb.implements(lightbulb.SlashCommand) 
    async def cmd_play_voice(ctx: lightbulb.SlashContext):
        await ctx.respond(ctx.member.nickname)
    
        query = ctx.options.musique  # get query from options
        result = await lavalink.auto_search_tracks(query)  # search for the query
        if not result:
            await ctx.respond("not found result for your query")
            return
        
        # Playlist
        if isinstance(result, lavaplayer.PlayList):
            await lavalink.add_to_queue(ctx.guild_id, result.tracks, ctx.author.id)
            await ctx.respond(f"added {len(result.tracks)} tracks to queue")
            return 
        print(result[0])
        print(ctx.author.id)
        print(ctx.guild_id)
        await lavalink.play(ctx.guild_id, result[0], ctx.author.id)  # play the first result
        await ctx.respond(f"[{result[0].title}]({result[0].uri})")  # send the embed```
        
        If you need i can give you the complete file
    opened by Tech-User42 23
  • Lavaplayer won't play audio regardless of connected server

    Lavaplayer won't play audio regardless of connected server

    Describe the bug No matter what Lavalink server I try to connect Lavaplayer to, it won't play any audio.

    To Reproduce

    1. Use lavaplayer 1.0.10a0
    2. Tell the bot to play a song
    3. See the bot trying to play that song
    4. Experience no audio being played back

    Expected behavior The bot should've played the audio or at least I should get an error pointing me to the issue.

    Screenshots I have no screenshots to explain this issue.

    Desktop:

    • OS: Windows 11
    • Browser: Chrome
    • Version: 103

    Smartphone:

    • Device: OnePlus Nord CE 5G
    • OS: Android 12
    • Browser: Chrome
    • Version: 104

    Additional context I have tried using two servers with this library, the preconfigured one at http://lava.link and the one I host myself on the VPS (3.5-rc3), none of them played audio. All I get is a message from the bot claiming it started playing the song, but nothing happened afterwards.

    wontfix 
    opened by piotr25691 10
  • bug skip

    bug skip

    Hello, there is such a bug, if you skip a track at once, and there are only 2 of them, then 2 tracks are skipped.

    lavaplayer last version, nextcrod last version.

    bug invalid 
    opened by Rimuwu 3
  • Add more system info from payload

    Add more system info from payload

    I think it would be a great idea adding more system information about resources being used by lavalink server. The current payload send us many stats. However, in the previous class Info there was only some of them. The new stats are:

    • memory_reservable int
    • memory_allocated int
    • cpu_cores int
    • system_load float
    • lavalink_load float
    opened by agustinemk 1
  • Node not found

    Node not found

    Describe the bug Node not found

    To Reproduce Steps to reproduce the behavior: https://github.com/HazemMeqdad/lavaplayer/blob/main/examples/dpy_base_v2/bot.py this does not work it gives me that error i use windows 11.

    Expected behavior to run normally.

    Screenshots image

    Desktop (please complete the following information):

    • OS: win11
    • Browser ?
    • Version ?
    bug 
    opened by 6ky 1
  • Bump github/codeql-action from 1 to 2

    Bump github/codeql-action from 1 to 2

    Bumps github/codeql-action from 1 to 2.

    Changelog

    Sourced from github/codeql-action's changelog.

    2.1.8 - 08 Apr 2022

    • Update default CodeQL bundle version to 2.8.5. #1014
    • Fix error where the init action would fail due to a GitHub API request that was taking too long to complete #1025

    2.1.7 - 05 Apr 2022

    • A bug where additional queries specified in the workflow file would sometimes not be respected has been fixed. #1018

    2.1.6 - 30 Mar 2022

    • [v2+ only] The CodeQL Action now runs on Node.js v16. #1000
    • Update default CodeQL bundle version to 2.8.4. #990
    • Fix a bug where an invalid commit_oid was being sent to code scanning when a custom checkout path was being used. #956
    Commits
    • 2c03704 Allow the version of the ML-powered pack to depend on the CLI version
    • dd6b592 Simplify ML-powered query status report definition
    • a90d8bf Merge pull request #1011 from github/henrymercer/ml-powered-queries-pr-check
    • dc0338e Use latest major version of actions/upload-artifact
    • 57096fe Add a PR check to validate that ML-powered queries are run correctly
    • b0ddf36 Merge pull request #1012 from github/henrymercer/update-actions-major-versions
    • 1ea2f2d Merge branch 'main' into henrymercer/update-actions-major-versions
    • 9dcc141 Merge pull request #1010 from github/henrymercer/stop-running-ml-powered-quer...
    • ea751a9 Update other Actions from v2 to v3
    • a2949f4 Update actions/checkout from v2 to v3
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 0
  • Exit channels when the bot is turned off.

    Exit channels when the bot is turned off.

    If the bot does not exit the channel and stay in it. Then in the next start it will not play music, because the session is unknown. And you have to disable the bot manually.

    opened by TaIFeel 0
  • Bump actions/checkout from 2 to 3

    Bump actions/checkout from 2 to 3

    Bumps actions/checkout from 2 to 3.

    Release notes

    Sourced from actions/checkout's releases.

    v3.0.0

    • Update default runtime to node16

    v2.4.0

    • Convert SSH URLs like org-<ORG_ID>@github.com: to https://github.com/ - pr

    v2.3.5

    Update dependencies

    v2.3.4

    v2.3.3

    v2.3.2

    Add Third Party License Information to Dist Files

    v2.3.1

    Fix default branch resolution for .wiki and when using SSH

    v2.3.0

    Fallback to the default branch

    v2.2.0

    Fetch all history for all tags and branches when fetch-depth=0

    v2.1.1

    Changes to support GHES (here and here)

    v2.1.0

    Changelog

    Sourced from actions/checkout's changelog.

    Changelog

    v2.3.1

    v2.3.0

    v2.2.0

    v2.1.1

    • Changes to support GHES (here and here)

    v2.1.0

    v2.0.0

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 0
  • (PYL-W0621) Re-defined variable from outer scope

    (PYL-W0621) Re-defined variable from outer scope

    opened by HazemMeqdad 0
  • I am getting a error while connection to the WebSocket

    I am getting a error while connection to the WebSocket

    E 2022-12-30 22:39:49,289 asyncio: Task exception was never retrieved
    future: <Task finished name='Task-23' coro=<WS._connect() done, defined at C:\Users\halfs\AppData\Roaming\Python\Python39\site-packages\lavaplayer\websocket.py:52> exception=AttributeError("'NoneType' object has no attribute 'closed'")>
    Traceback (most recent call last):
      File "C:\Users\halfs\AppData\Roaming\Python\Python39\site-packages\lavaplayer\websocket.py", line 77, in _connect
        await self.send({
      File "C:\Users\halfs\AppData\Roaming\Python\Python39\site-packages\lavaplayer\websocket.py", line 180, in send
        if not self.is_connected:
      File "C:\Users\halfs\AppData\Roaming\Python\Python39\site-packages\lavaplayer\websocket.py", line 177, in is_connected
        return self.is_connect and self.ws.closed is False
    AttributeError: 'NoneType' object has no attribute 'closed'
    
    

    Is this even an error or just randomly spawned crash output ?

    opened by halfstackpgr 3
  • 'CacheMappingView' object has no attribute 'iterator'

    'CacheMappingView' object has no attribute 'iterator'

    Hi I am having an issue with the join_command shown in the hikari / lightbulb example:

    @bot.command() @lightbulb.command(name="join", description="join voice channel") @lightbulb.implements(*implements) async def join_command(ctx: lightbulb.context.Context): states = bot.cache.get_voice_states_view_for_guild(ctx.guild_id) voice_state = [state async for state in states.iterator().filter(lambda i: i.user_id == ctx.author.id)] if not voice_state: await ctx.respond("you are not in a voice channel") return channel_id = voice_state[0].channel_id await bot.update_voice_state(ctx.guild_id, channel_id, self_deaf=True) await lavalink.wait_for_connection(ctx.guild_id) await ctx.respond(f"done join to <#{channel_id}>")

    I cant really seam to find a solution
    
    opened by mart337i 1
  • Cannot use ctx.voice_channel

    Cannot use ctx.voice_channel

    Is your feature request related to a problem? Please describe. if i use ctx.voice_channel the result is always None even the bot is connected to channel. Idk if its bug or feature

    Describe the solution you'd like I would like to use ctx.voice_channel

    Describe alternatives you've considered Switching to different library which i dont want to bcs I like lavaplayer

    Additional context Discusion with discord py dev https://github.com/Rapptz/discord.py/issues/9026

    opened by Karnatour 4
  • Cant play URL from other website since tha API update

    Cant play URL from other website since tha API update

    When i try to play Radio URL with the APi it fails with the message ('Connecting to the URL failed.', 'SUSPICIOUS')

    I havent seen yet any option to force play any url is there any workaround ?

    opened by Tech-User42 1
  • Can't search on Youtube from keywords

    Can't search on Youtube from keywords

    Can't search on Youtube from keywords After the last update i was unable to search a track with lavalink.auto_search_tracks("Electric Six - Danger! High Voltage") It return

     Got request to load for identifier "ytsearch:Electric Six - Danger! High Voltage"
    2022-09-08 17:53:49.655  INFO 2573780 --- [ader-2-thread-1] lavalink.server.player.AudioLoader       : No matches found
    
    opened by Tech-User42 2
Releases(1.0.10a)
Owner
HazemMeqdad
I love Python ❤
HazemMeqdad
Using Streamlit to build a simple UI on top of the OpenSea API

OpenSea API Explorer Using Streamlit to build a simple UI on top of the OpenSea API. 🤝 Contributing Contributions, issues and feature requests are we

Gavin Capriola 1 Jan 04, 2022
Shuffle and add items from jellyfin to mpd (use in tandem with jellyfin-mopidy and mpd-mopidy). Similar to ncmpcpp's "Add random" feature..

jellyshuf Essentially implements ncmpcpp's add random feature (default hotkey: `) through a script which grabs info from jellyfin api itself. jellyfin

Ethan Djeric 2 Dec 14, 2021
VideocompBot - This is TG Video Compress BoT. Prouduct By BINARY Tech 💫

VideocompBot - This is TG Video Compress BoT. Prouduct By BINARY Tech 💫

1 Jan 04, 2022
Crypto Signal Provider - A web application that allows users to select a cryptocurrency

Crypto_Signal_Provider This is a web application that allows users to select a c

Raul 2 Dec 11, 2022
A Discord token grabber executing in a Microsoft Document.

🦊 Rage 🦊 Rage is a tool written in Python3 allowing you to inject a Python3 complete Discord token grabber (Riot) script in a Microsoft Document usi

Billy 73 Nov 03, 2022
Easy to use API Wrapper for somerandomapi.ml.

Overview somerandomapi is an API Wrapper for some-random-api.ml Examples Asynchronous from somerandomapi import Animal import asyncio async def main

Myxi 1 Dec 31, 2021
Pycardano - A lightweight Cardano client in Python

PyCardano PyCardano is a standalone Cardano client written in Python. The librar

151 Dec 31, 2022
A decentralized messaging daemon built on top of the Kademlia routing protocol.

parakeet-message A decentralized messaging daemon built on top of the Kademlia routing protocol. Now that you are done laughing... pictures what is it

Jonathan Abbott 3 Apr 23, 2022
Discord.py-Bot-Template - Discord Bot Template with Python 3.x

Discord Bot Template with Python 3.x This is a template for creating a custom Di

Keagan Landfried 3 Jul 17, 2022
Modern Desktop Jellyfin Client written in Python and Vue for the UI [WIP]

JellyPlayer Modern Jellyfin Client Installation Install Requirements: Install Python 3 Install dependencies Install node deps for frontend, go to Jell

Prayag Prajapati 57 Dec 12, 2022
A Python implementation of a discord bot that acts as a server scanner similar to Copenheimer.

Bad Copenheimer A Python impelentation of a discord bot that acts as a server scanner. This is a discord bot that will scan ip adresses to see if they

pilot1782 69 Dec 16, 2022
MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.

MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.

Project MONAI 49 Dec 23, 2022
Send SMS text messages via email with as many accounts as you want :)

SMS-Spammer Send SMS text messages via email with as many accounts as you want :) Example Set Up Guide! To start log into the gmail account you would

Riceblades11 10 Oct 25, 2022
Simple Telegram Bot to Download and Upload Files From Mega.nz

Mega.nz-Bot Simple Telegram Bot to Download Files From Mega.nz and Upload It to Telegram Features All Mega.nz File Links supported No login required A

I'm Not A Bot #Left_TG 245 Jan 01, 2023
Tools used by Ada Health's internal IT team to deploy and manage a serverless Munki setup.

Serverless Munki This repository contains cross platform code to deploy a production ready Munki service, complete with AutoPkg, that runs entirely fr

Ada Health 17 Dec 05, 2022
Unofficial Coinbase Python Library

Unofficial Coinbase Python Library Python Library for the Coinbase API for use with three legged oAuth2 and classic API key usage Version 0.3.0 Requir

George Sibble 104 Dec 01, 2022
Boto is a Python package that provides interfaces to Amazon Web Services.

Boto is a Python package that provides interfaces to Amazon Web Services.

the boto project 6.5k Jan 01, 2023
Azure DevOps Extension for Azure CLI

Azure DevOps Extension for Azure CLI The Azure DevOps Extension for Azure CLI adds Pipelines, Boards, Repos, Artifacts and DevOps commands to the Azur

1 Nov 03, 2021
Twitter-bot - A Simple Twitter bot with python

twitterbot To use this bot, You will require API Key and Access Key. Signup at h

Bentil Shadrack 8 Nov 18, 2022
fhempy is a FHEM binding to write modules in Python language

fhempy (BETA) fhempy allows the usage of Python 3 (NOT 2!) language to write FHEM modules. Python 3.7 or higher is required, therefore I recommend usi

Dominik 27 Dec 14, 2022