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
Telegram bot for downloading covid-19 vaccine certificate

cowin-certificate-bot This is the source code of @cowincertbot, A telegram bot inspired by the whatsapp bot implementation of indian government for co

ArUn Pt 30 Oct 07, 2022
Diablo II Resurrected helper

Diablo II Resurrected 快捷施法辅助 功能: + 创建守护进程,注册全局热键 alt+/ 启用和关闭功能 (todo: 播放声音提示) + 按 x 强制移动 + 按 1 ~ 0 快捷施法到鼠标区域 使用 编辑配置 settings.py 技能信息做如下定义: SKILLS:

Wan 2 Nov 06, 2022
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
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
Discord Token Generator based on HTTPX, makes unverified tokens and automatically joins your server! this is used for memberboosting

Discord Token Generator | 2021 Features: (1) hCaptcha Bypasser, latest hfuck.py Updated by me (2) Free Proxy Support/Scrapper (3) Custom Realistic Dat

2 Nov 30, 2021
Python script to harvest tweets with the Twitter API V2 Academic Research Product Track

Tweet harvester Python script to scrape, collect, and/or harvest tweets with the Twitter API V2 Academic Research Product Track. Important note: In or

Thomas Frissen 2 Nov 11, 2021
Get some python in google cloud functions

[NOTE]: This is a highly experimental (and proof of concept) library so do not expect all python packages to work flawlessly. Also, cloud functions ar

Martin Abelson Sahlen 200 Nov 24, 2022
Notification Reminder Application For Python

Notification-Reminder-Application No matter how well you set up your to-do list and calendar, you aren’t going to get things done unless you have a re

1 Nov 26, 2021
Guilherme Matheus 11 Sep 11, 2022
Cities bot - A simple example of using aiogram and the wikipedia package

Cities game A simple example of using aiogram and the wikipedia package. The bot

Artem Meller 2 Jan 29, 2022
A community Billy vs SNAKEMAN bot

BvS Bot A discord bot built for the Billy vs SNAKEMAN community! Dependencies An installation of Python 3.9.x with ssl compiled. The following pip pac

Neopolitan 2 May 10, 2022
BingBot - A bot that will automate searches on bing

bingBot A bot that will automate searches on bing. To install this just download

Lukas 2 Jul 28, 2022
The successor of GeoSnipe, a pythonic Minecraft username sniper based on AsyncIO.

OneSnipe The successor of GeoSnipe, a pythonic Minecraft username sniper based on AsyncIO. Documentation View Documentation Features • Mojang & Micros

1 Jan 14, 2022
Discord Token Checker

Discord-Token-Checker Optimizations Asynchronous Fast & Efficient Multi Tasked Proxy support (socks4/socks5/http) Usage Put tasks depending on your PC

scripted 6 May 05, 2022
The Dolby.io Developer Days Getting Started with Media APIs Workshop repo.

Dolby.io Developer Days Media APIs Getting Started Application About this Workshop and Application This example is designed to get participants workin

Dolby.io Samples 2 Nov 03, 2022
Discord bot developed by Delhi University Student Community!

DUSC-Bot Discord bot developed by Delhi University Student Community! Libraries Used Pycord - Documentation Features Can purge messages in bulk Drop-D

professor 1 Jan 29, 2022
Opasium AI was specifically designed for the Opasium Games discord only. It is a bot that covers the basic functions of any other bot.

OpasiumAI Opasium AI was specifically designed for the Opasium Games discord only. It is a bot that covers the basic functions of any other bot. Insta

Dan 3 Oct 15, 2021
Free & open source API service for obtaining information about +9600 universities worldwide.

Free & open source API service for obtaining information about +9600 universities worldwide.

Yagiz Degirmenci 57 Nov 04, 2022
Métamorphose Renamer v2

Métamorphose 2 Métamorphose is a graphical mass renaming program for files and folders. These are the command line options: -h, --help Show hel

Métamorphose 129 Dec 30, 2022
A python crypto trading bot on Binance using RSI in 25 Lines 🚀

RSI Crypto Trading Bot - Binance A Crypto Trading Bot on Binance trading BTCUSDT and ETHUSDT using RSI in 25 Lines of Code Getting Started Note Python

Blankly Finance 10 Dec 26, 2022