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
AWS Blog post code for running feature-extraction on images using AWS Batch and Cloud Development Kit (CDK).

Batch processing with AWS Batch and CDK Welcome This repository demostrates provisioning the necessary infrastructure for running a job on AWS Batch u

AWS Samples 7 Oct 18, 2022
discord.js nuker (50 bans a sec)

js-nuker discord.js nuker (50 bans a sec) I was to lazy to make the scraper in js, but this works too. DISCLAIMER This is tool was made for educationa

4 Sep 11, 2021
This is a discord bot, which tells you food recipes.

Discord Chef Bot You have a friend, familiy or other group / channel where the topic is the food? You cannot really decide what's for Saturday lunch?

2 Apr 25, 2022
Telegram bot with various Sticker Tools

Sticker Tools Bot @Sticker_Tools_Bot A star ⭐ from you means a lot to us! Telegram bot with various Sticker Tools Usage Deploy to Heroku Tap on above

Stark Bots 20 Dec 08, 2022
An open souce video/music streamer based on MPV and piped.

🎶 Harmony Music An easy way to stream videos or music from Youtube from the command line while regaining your privacy. 📖 Table Of Contents ❔ What's

Zingy Tomato 16 Nov 15, 2022
This is a tool to help people to make a bot for labelling images for machine learning projects.

labeller_images_python_telegramBOT This is a bot to help collect data for any machine learning project. It was developed using the python-telegram-bot

Diego Silveira 2 Nov 13, 2021
doi, pubmed, arxiv.org的查询服务API接口,部署于vercel云函数

article-search-service doi, pubmed, arxiv.org的查询服务API接口,部署于vercel云函数 云函数 vercel,国内可能被qiang了。 DOI接口 POST https://article-search-service.vercel.app/api/

HyokaChen 2 Oct 10, 2021
Stack overflow search API

Stack overflow search API

Vikash Karodiya 1 Nov 15, 2021
A discord.py bot template with Cogs implemented.

discord-cogs-template A discord.py bot template with Cogs implemented. Instructions Before you start ⚠ Basic knowledge of python is required. Steps If

censor 2 Sep 02, 2022
Program that uses Python to monitor grade updates in the Genesis Platform

Genesis-Grade-Monitor Program that uses Python to monitor grade updates in the Genesis Platform Guide: Install by either cloning the repo or downloadi

Steven Gatanas 1 Feb 12, 2022
Discord Account Generator that will create Account with hCaptcha bypass. Using socks4 proxies

Account-Generator [!] This was made for education. Please use socks4 proxies for nice experiences. [!] Please install these modules - "pip3 install ht

RyanzSantos 10 Feb 23, 2022
Stinky ID - A stable pluggable Telegram userbot + Voice & Video Call music bot, based on Telethon

Ultroid - UserBot A stable pluggable Telegram userbot + Voice & Video Call music

Riyan.rz 1 Jan 03, 2022
A module grouping multiple translation APIs

translatepy (originally: translate) An aggregation of multiple translation API Translate, transliterate, get the language of texts in no time with the

349 Jan 06, 2023
AWS Lambda Fast API starter application

AWS Lambda Fast API Fast API starter application compatible with API Gateway and Lambda Function. How to deploy it? Terraform AWS Lambda API is a reus

OBytes 6 Apr 20, 2022
Python async SDK for betsapi.com

Python async SDK for betsapi.com

1 Dec 21, 2021
A Python interface between Earth Engine and xarray for processing weather and climate data

wxee What is wxee? wxee was built to make processing gridded, mesoscale time series weather and climate data quick and easy by integrating the data ca

Aaron Zuspan 160 Dec 31, 2022
Kyura-Userbot: a modular Telegram userbot that runs in Python3 with a sqlalchemy database

Kyura-Userbot Telegram Kyura-Userbot adalah userbot Telegram modular yang berjal

Kyura 17 Oct 29, 2022
Playing around with the slack api for learning purposes

SlackBotTest Playing around with the slack api for learning purposes and getting people to contribute Reason for this Project: Bots are very versatile

1 Nov 24, 2021
Algofi Python SDK is useful for developers who want to programatically interact with the Algofi lending protocol

algofi-py-sdk Algofi Python SDK Documentation https://algofi-py-sdk.readthedocs.

Algofi 41 Dec 15, 2022
Demonstrating attacks, mitigations, and monitoring on AWS

About Inspectaroo is a web app which allows users to upload images to view metadata. It is designed to show off many AWS services including EC2, Lambd

Alex McCormack 1 Feb 11, 2022