Giter Site home page Giter Site logo

devoxin / lavalink.py Goto Github PK

View Code? Open in Web Editor NEW
222.0 222.0 96.0 1.12 MB

A wrapper for Lavalink in Python, which aims to be powerful and intuitive.

Home Page: https://lavalink.readthedocs.io/

License: MIT License

Python 99.94% Batchfile 0.06%
discord lavalink lavaplayer python wrapper

lavalink.py's People

Contributors

aareon avatar alexflipnote avatar andytempel avatar apex2504 avatar atiwiex avatar bachtran02 avatar burtonwilliamt avatar dependabot-support avatar devoxin avatar khilseith avatar lepeli avatar omniplast avatar rapptz avatar sh0tx420 avatar soulsen avatar taarek avatar tailoric avatar tekulvw avatar vbe0201 avatar zenrac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lavalink.py's Issues

After i installed dpy 2.0 music doesn't works

Summary

bot join voice channel but music doesn't works

Lavalink & System Version

discord.py 2.0, ubuntu 18, last version of Lavalink and Lavalink.jar

Reproduction

изображение

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible?
  • [0] Have you given a traceback if possible?

Exception in lavalink Events creates weird issues

It seems that raising an exception (any exception) in a lavalink.event will stuck the event.

How to repro (with v2 or v3 example) :

        elif isinstance(event, lavalink.Events.TrackEndEvent):
            print("TrackEndEvent called")
            raise Exception('This error will block the nexts TrackEndEvent')    

You can try yourself to play some songs and see that the TrackEndEvent is stuck

Certain parts of readthedocs misleading / mising / typoed

Summary

On the readthedocs page for lavalink.py under the DefaultPlayer section the .repeat definitions states "Whether or not to continuously to play a track.". This sounds like DefaultPlayer.current will seek back to 0 when finished while this bool is True but in fact repeats the whole queue when the bool is True.

Spotted a typo: "Whether or not to continuously to play a track" under the DefaultPLayer.repeat section

DefaultPlayer.set_repeat(repeat:bool) is also missing from the documentation as far as ctrl+f / readthedocs search is concerned.

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?

Version issue?

java.lang.UnsupportedClassVersionError: lavalink/server/info/AppInfo has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I just downloaded the lastest version of Java and this is the error I get when running the java -jar command in terminal

Getting AttributeError: 'AudioTrack' object has no attribute 'get'

Hey i am using lavalink V4 and i am getting this error

Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Users\nirma\AppData\Roaming\Python\Python310\site-packages\disnake\client.py", line 515, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\nirma\Desktop\new-discord-bot\cogs\logs.py", line 147, in on_command_error
    raise error
  File "C:\Users\nirma\AppData\Roaming\Python\Python310\site-packages\disnake\ext\commands\core.py", line 169, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\nirma\Desktop\new-discord-bot\cogs\new_music.py", line 458, in play
    track = ImageTrack(data=track, requester=ctx.author.id, image=await self.get_soundcloud_artwork(track["info"]["uri"]))
  File "C:\Users\nirma\Desktop\new-discord-bot\cogs\new_music.py", line 20, in __init__
    super().__init__(data, requester, **extra)
  File "C:\Users\nirma\AppData\Roaming\Python\Python310\site-packages\lavalink\models.py", line 78, in __init__
    info = data.get('info', data)
AttributeError: 'AudioTrack' object has no attribute 'get'

code

class ImageTrack(lavalink.models.AudioTrack):
    def __init__(self, data: dict, requester: int, **extra):
        super().__init__(data, requester, **extra)
        self.image = extra['image']

here is the image of lavalink code
image

UnicodeDecodeError

Summary

On request song/play

Lavalink & System Version

Linux: ubuntu 18.04
Python: 3.6
Lavalink.py: 3.1.4
Lavalink Player: Build #1186

Reproduction

  • any code will have same results when the video uploader have weird letters in they're name

Expected Results

  • Normal results should pass the video author name

Actual Results

Thoughts out an error

Error

UnicodeDecodeError
'utf-8' codec can't decode byte 0xed in position 19: invalid continuation byte

Where in code is the error

  • File: utils.py | @ decode_track at line: 68
    Screenshot_12

    title = reader.read_utf().decode(errors=decode_errors)
    author = reader.read_utf().decode()
    length = reader.read_long()
    identifier = reader.read_utf().decode()
    is_stream = reader.read_boolean()
    uri = reader.read_utf().decode() if reader.read_boolean() else None
    source = reader.read_utf().decode()

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible?
  • Have you given a traceback if possible?

Broken playback of some tracks

Summary

When playing some tracks, playback stops working. By "stops working" I mean the following:

  • The track that causes this behavior is not played
  • In case of skipping this track, the following tracks are also not played

The only solution is to restart the bot, or recreate the player

I would like to point out that a bot written in java(Lavalink-client) using the same server behaves normally

Lavalink & System Version

The systems where I checked it out: Windows 11(23H2), Debian 11, Ubuntu, Ubuntu server

Pyhon version: 3.11.2
Lavalink.py version: lates(5.3.0)
Lavalink version version: lates(4.0.4)

Reproduction

Step 1:

  • Create simple music bot ( you can have this one )
  • Add a simple command to skip a track ( you can take this )

Step 2:

  • Play the track ( you can use this as an example. This problem was first shown to me with it)
  • Add 1-2 more tracks of any kind to the queue

Step 3:

  • Use the command to skip a track

Expected Results

The bot should have played the first track.
After using the command to skip, it should have started playing the second track

Actual Results

The bot does not play the first track, and even after skipping a track this problem persists

More info

I found a simple function to monitor requests and I used it to find out what was causing the behavior. As a result, I saw something unusual: *click*

Pay attention to "position". Unlike normal tracks, which are processed normally, the "position" value is frozen at 460. In case of skipping a track, this value does not change either

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible? ( using public server )
  • Have you given a traceback if possible?

Lavalink randomly stops running and gives the message 'killed'.

I am running lavalink on a aws linux server and when I detach the screen and leave lavalink running after some time it randomly kills itself. The bot stills works and stays online but none of the music commands work at all after some time. This time can be between 10 minutes and 2 hours in which it kills itself.

I reattached the terminal and this is the error message in which I recieve.

etServer : {"op": "play", "guildId": "764284423969046539", "track": "QAAAngIAOU1hcmsgUm9uc29uIC0gVXB0b3duIEZ1bmsgKE9mZmljaWFsIFZpZGVvKSBmdC4gQnJ1bm8gTWFycwALTWFyayBSb25zb24AAAAAAAQimAALT1BmMFliWHFEbTAAAQAraHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1PUGYwWWJYcURtMAAHeW91dHViZQAAAAAAAAAA"}
2020-11-15 15:05:53.418 INFO 4535 --- [ XNIO-1 I/O-1] lavalink.server.io.SocketServer : {"op": "voiceUpdate", "guildId": "777254786310340659", "sessionId": "4d4f6bf286004ed6a80cbb9bb7753945", "event": {"token": "bb01d27cdf3f2e6f", "guild_id": "777254786310340659", "endpoint": "us-east1573.discord.media:443"}}
2020-11-15 15:06:12.221 INFO 4535 --- [ XNIO-1 task-14] l.server.player.AudioLoaderRestHandler : Got request to load for identifier "ytsearch:ncs limitless"
2020-11-15 15:06:12.720 INFO 4535 --- [ader-2-thread-1] lavalink.server.player.AudioLoader : Loaded playlist Search results for: ncs limitless
2020-11-15 15:06:18.834 INFO 4535 --- [ XNIO-1 I/O-1] lavalink.server.io.SocketServer : {"op": "play", "guildId": "777254786310340659", "track": "QAAAkQIAJkVsZWt0cm9ub21pYSAtIExpbWl0bGVzcyBbTkNTIFJlbGVhc2VdABFOb0NvcHlyaWdodFNvdW5kcwAAAAAAA70IAAtjTmN5M0o0eDYyTQABACtodHRwczovL3d3dy55b3V0dWJlLmNvbS93YXRjaD92PWNOY3kzSjR4NjJNAAd5b3V0dWJlAAAAAAAAAAA="}
2020-11-15 15:06:59.739 INFO 4535 --- [ XNIO-1 I/O-1] lavalink.server.io.SocketServer : {"op": "stop", "guildId": "777254786310340659"}
2020-11-15 15:07:18.993 INFO 4535 --- [ XNIO-1 I/O-1] lavalink.server.io.SocketServer : {"op": "stop", "guildId": "764284423969046539"}
Killed

Add set_repeat

There is no such thing as set_repeat. I need this to fully complete my bot music.py

Can't load

Hi there,

When trying to load the cog it gives me this error:

- 'int' object has no attribute 'lavalink'

Some issues with example music cog

There's an issue here it seems with the deque change re: the queue command. I quickly fixed it like this (in the music.py example cog):

for i, track in enumerate(player.queue[start:end], start=start): 

to:

for i, track in enumerate(list(player.queue)[start:end], start=start): 

But I wouldn't say that changing the queue to a list is the most efficient way as it is doing two times the computation and for massive queues it could be slow, but I haven't noticed anything.

It fixes the slice error: - sequence index must be integer, not 'slice' on running the queue command.

Also, I don't think shuffle is implemented correctly. It also causes various - pop() takes no arguments (1 given) when trying to skip after turning shuffle on/off.

Please excuse any oversights; I'm not the most experienced in Python xD.

KeyError with on_voice_state_update event

Task exception was never retrieved
future: <Task finished coro=<WebSocket.listen() done, defined at C:\Users\Zenrac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lavalink\WebSocket.py:92> exception=KeyError('position',)>
Traceback (most recent call last):
  File "C:\Users\Zenrac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lavalink\WebSocket.py", line 130, in listen
    await self._lavalink.update_state(data)
  File "C:\Users\Zenrac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lavalink\Client.py", line 62, in update_state
    p.position = data['state']['position']
KeyError: 'position'

It seems to happen since I've added an on_voice_state_update event
I don't really know how to repro

Failed to load Cogs.music

Hello, i used the examplecode but then i get an nonetype error that i dont know how to solve:

Failed to load extension music.py
Traceback (most recent call last):
  File "D:\Downloads\Python\python 3.8.7\lib\site-packages\discord\ext\commands\bot.py", line 618, in _load_from_module_spec
    setup(self)
  File "D:\my_python_projects\MongoDB Test\Cogs\music.py", line 175, in setup
    bot.add_cog(Music(bot))
  File "D:\my_python_projects\MongoDB Test\Cogs\music.py", line 22, in __init__
    bot.lavalink = lavalink.Client(bot.user.id)
AttributeError: 'NoneType' object has no attribute 'id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:/my_python_projects/MongoDB Test/mongosetup.py", line 145, in <module>
    bot.load_extension(f"Cogs.{filename[:-3]}")
  File "D:\Downloads\Python\python 3.8.7\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
    self._load_from_module_spec(spec, name)
  File "D:\Downloads\Python\python 3.8.7\lib\site-packages\discord\ext\commands\bot.py", line 623, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'Cogs.music' raised an error: AttributeError: 'NoneType' object has no attribute 'id'

Websockets versions are incompatible

wsproto 0.11.0 has requirement h11~=0.7.0, but you'll have h11 0.8.0 which is incompatible.
discord-py 1.0.0a1467+g6b75179 has requirement websockets<4.0,>=3.0, but you'll have websockets 5.0.1 which is incompatible.

This results in the bot not playing anything.

After loading Lavalink.jar, it plays the every first song that we pass in and stops working after that

Summary

After we run the Lavalink.jar file, it establishes connection, after that whenever we play very first song, it plays nicely, but if we disconnect the bot after that and try to play another song, it doesnt work.

Lavalink & System Version

Reproduction

This is the where the jar file gets stuck at (in the terminal)
Loaded playlist Search results for: bekhayali
2020-11-13 12:23:28.786 INFO 34228 --- [ XNIO-1 I/O-4] lavalink.server.io.SocketServer : {"op": "play", "guildId": "760517589100527656", "track": "QAAAxgIAZEJla2hheWFsaSBGdWxsIFNvbmcgfCBLYWJpciBTaW5naCB8IFNoYWhpZCBLLEtpYXJhIEF8U2FuZGVlcCBSZWRkeSBWYW5nYSB8IFNhY2hldC1QYXJhbXBhcmEgfCBJcnNoYWQACFQtU2VyaWVzAAAAAAAFZtAAC1ZPTEtKSnZmQWJnAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9Vk9MS0pKdmZBYmcAB3lvdXR1YmUAAAAAAAAAAA=="}

Expected Results

The current song will stop when it disconnects.

Actual Results

The previous song never stops. If we disconnect the bot from the vc, and reconnect it, the bots seems to be playing something but nothing is audible

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible?
  • Have you given a traceback if possible?

Playback stops when discord reconnects the gateway

Summary

When discord sends a reconnect payload and discord.py reconnects with a resume, the playback stops.

Lavalink & System Version

OS: Windows 10 & Centos 8.1 | Python 3.7.5 | Lavalink.py 3.1.0 |Lavalink latest (3.x)

Reproduction

Just playing any track or queue for a long time.
Turn on logging for discord.py to info so you can see gateway reconnects

Expected Results

The audio plays none-stop continuously without problems.

Actual Results

The audio stops whenever discord.py reconnects to the gateway or when discord sends a reconnect payload and causes the library to reconnect.

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible?
  • [-] Have you given a traceback if possible?
    There is no traceback error, lavalink.py acts like nothing happened, and the server still sends things normally.

Lavalink for async?

Is it possible to make lavalink.py working on async? I changed every ctx.send etc. to async version, but now im getting this error:

    results = await self.bot.lavalink.get_tracks(query)
  File "C:\Users\Style\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lavalink\Client.py", line 135, in get_tracks
    return await res.json(content_type=None)
TypeError: json() got an unexpected keyword argument 'content_type'

[Example] Guild.region is removed from discord.py

Summary

As Guild.region is removed. The example is needed to be fixed

Lavalink & System Version

OS: Linux
Python Version: 3.9.10
Lavalink.py: master
Lavalink Version: Latest (3.4)

Reproduction

In ensure_voice method

async def ensure_voice(self, ctx):
        """ This check ensures that the bot and command author are in the same voicechannel. """
        player = self.bot.lavalink.player_manager.create(ctx.guild.id, endpoint=str(ctx.guild.region))
        # Create returns a player if one exists, otherwise creates.
        # This line is important because it ensures that a player always exists for a guild.

        # Most people might consider this a waste of resources for guilds that aren't playing, but this is
        # the easiest and simplest way of ensuring players are created.

        # These are commands that require the bot to join a voicechannel (i.e. initiating playback).
        # Commands such as volume/skip etc don't require the bot to be in a voicechannel so don't need listing here.
        should_connect = ctx.command.name in ('play',)

        if not ctx.author.voice or not ctx.author.voice.channel:
            # Our cog_command_error handler catches this and sends it to the voicechannel.
            # Exceptions allow us to "short-circuit" command invocation via checks so the
            # execution state of the command goes no further.
            raise commands.CommandInvokeError('Join a voicechannel first.')

        if not player.is_connected:
            if not should_connect:
                raise commands.CommandInvokeError('Not connected.')

            permissions = ctx.author.voice.channel.permissions_for(ctx.me)

            if not permissions.connect or not permissions.speak:  # Check user limit too?
                raise commands.CommandInvokeError('I need the `CONNECT` and `SPEAK` permissions.')

            player.store('channel', ctx.channel.id)
            await ctx.author.voice.channel.connect(cls=LavalinkVoiceClient)
        else:
            if int(player.channel_id) != ctx.author.voice.channel.id:
                raise commands.CommandInvokeError('You need to be in my voicechannel.')

Expected Results

Create a play_manager

Actual Results

Raised AttributeError: 'Guild' object has no attribute 'region'

To fix that

Use VoiceChannel.rtc_region attribute

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible?
  • Have you given a traceback if possible?

Attempting to change bands through set_gains() causes the player to forcefully disconnect

Summary

Attempting to modify gains through set_gains(listoftuples) crashes the player and forcefully makes the bot crash

tested with player.set_gain((0, 0.75), (1, 0.75), (2, 0.75), (3, 1), (5, 0.75))

Lavalink & System Version

Linux ARM64 Ubuntu 20.10, Lavalink 3.1.4, OpenJDK 15, Python 3.7

Reproduction

code
@commands.command(
        name='bass',
        brief='blow eardrums up'
    )
    @commands.check(djconfig)
    async def bass(self, ctx, gain: int = 0):
        """increases the base."""
        player = self.bot.lavalink.player_manager.get(ctx.guild.id)
        if player:
            if player.current is None:
                await ctx.send('*⃣ | Bot is not playing any music.')

        gain = max(min(1, gain), -0.25)
        await player.set_gains((0, gain*.75),(1, gain*.75),(2, gain*.75),(3, gain),(4, gain*.75))
        if gain:
            await ctx.send(f'Bass set to {(gain+1)*100}%')
        else:
            await ctx.send('Bass set to 100%')

Put a gain of 1 for the gain input
Have the bot instantly disconnect from VC due to track decoding error

Expected Results

For the bass to increase and to not crash

Actual Results

Upon payload being received bot instantly leaves voicechat and prints this rather vague traceback

Traceback ``` DEBUG:lavalink:[NODE-us-127.0.0.1:2333] Sending payload {'op': 'equalizer', 'guildId': '671735916712165406', 'bands': [{'band': 0, 'gain': 0.75}, {'band': 1, 'gain': 0.75}, {'band': 2, 'gain': 0.75}, {'band': 3, 'gain': 1.0}, {'band': 4, 'gain': 0.75}]} DEBUG:lavalink:[NODE-us-127.0.0.1:2333] Received WebSocket message: {"op":"event","type":"TrackExceptionEvent","track":"QAAAfgIAG0luaXRpYWwgRCAtIEtpbGxpbmcgTXkgTG92ZQAJUHJldHR5IG9rAAAAAAAEhEAAC1lkWXdJQ05QRHdJAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9WWRZd0lDTlBEd0kAB3lvdXR1YmUAAAAAAAAMWA==","error":"Something went wrong when decoding the track.","guildId":"671735916712165406"} DEBUG:lavalink:Dispatched TrackExceptionEvent to all registered hooks DEBUG:lavalink:[NODE-us-127.0.0.1:2333] Sending payload {'op': 'stop', 'guildId': '671735916712165406'} DEBUG:discord.gateway:Updating our voice state to {'op': 4, 'd': {'guild_id': '671735916712165406', 'channel_id': None, 'self_mute': False, 'self_deaf': False}}. DEBUG:lavalink:[NODE-us-127.0.0.1:2333] Received WebSocket message: {"op":"event","reason":"STOPPED","type":"TrackEndEvent","track":"QAAAfgIAG0luaXRpYWwgRCAtIEtpbGxpbmcgTXkgTG92ZQAJUHJldHR5IG9rAAAAAAAEhEAAC1lkWXdJQ05QRHdJAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9WWRZd0lDTlBEd0kAB3lvdXR1YmUAAAAAAAAMWA==","guildId":"671735916712165406"} DEBUG:lavalink:[NODE-us-127.0.0.1:2333] Received WebSocket message: {"op":"event","reason":"Disconnected.","code":4014,"byRemote":true,"type":"WebSocketClosedEvent","guildId":"671735916712165406"} ```

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible?
  • Have you given a traceback if possible?

Stops playing if deafened

Hi this ins't technicly a bug but the bot stops playing when ever i deafen it and is quit until the next song

Small (but very nice to have) missing type def.

Summary

No typing for DefaultPlayer.node. Would make intellisense a lot better when working with this library.

As I wrote in the title, its a fairly small thing but adding ': lavalink.Node' to the 'self.node = node' line in the BasePlayer class def would make intellisense a lot more useful when writing song search.... stuff.

Unrelated but thanks for all your work on the project! Came back to it after a couple years of building my bot with discord.js and its way nicer to use than my last library for Lavalink.
And filters! So glad there's filters now.

Lavalink & System Version

Pretty sure this is OS agnostic, but I'm on Ubuntu 22.10, python 3.10.7, Lavalink.py v4.0.4

Reproduction

Just drop into the default example in vscode with python intellisense enabled and hover over any instance of 'player.node.xyz'

Expected Results

any BasePlayer.node to be typed as (at least I assume this is right) lavalink.Node

Actual Results

No intellisense

Checklist

  • Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible?
  • Have you given a traceback if possible?

aiohttp version upgrade

Summary

when trying to install lavalink.py it tries to install a version of aiohttp which is unsupported by python 3.12

Lavalink & System Version

OS: Windows
Python version: 3.12
Lavalink.py: 5.1.0

Reproduction

run pip install lavalink

aiohttp version update

Hello, could you please mind updating the required aiohttp version requirements.

Lavalink current aiohttp version requirement: 3.6.0
Please update it to version 3.7.3 or later

Help with Music Bot Code

@commands.command()
async def play(self, ctx, url):
song_there = os.path.isfile("song.mp3")
try:
if song_there:
os.remove("song.mp3")
except PermissionError:
await ctx.send("Wait for the current playing music to end or use the 'stop' command")

    voiceChannel = discord.utils.get(ctx.guild.voice_channels)
    await voiceChannel.connect()
    voice = discord.utils.get(self.client.voice_clients, guild=ctx.guild)

    ydl_opts = {
        'format': 'bestaudio/best',
        'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3',
            'preferredquality': '192',
        }]
    }
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download([url])
    for file in os.listdir("./"):
        if file.endswith(".mp3"):
            os.rename(file, "song.mp3")
    voice.play(discord.FFmpegPCMAudio('song.mp3'))
    
    
   **This is my current code I'm using to play music through my bot, but after some searching over the internet, I am unsure of how to have the bot queue music, because whenever I try to queue two songs, it'll say in the terminal that the bot is already connected to the voice channel. I couldn't get any other help so maybe I'd be able to get some here.. Thanks!**

Links broke

I am currently trying to play music with a youtube link but it doesnt work. Any reason why? Idk

Constant spam of 'Disconnected with code None and reason None' in console

Every +- 30 seconds the following error keeps getting spammed into my console, even when its not playing music:

[NODE-eu-clerq-:80] Disconnected with code None and reason None
Unable to move players, no available nodes! Waiting for a node to become available.

Any way to supress/fix this error?

[Question] Volume in lavalink v3

Lavalink V3 supports volume value to be set up to 1000. What would be the best way to implement that feature without removing the support for lavalink v2.
My ideas:

  • Prompting the user to specify the version when initiating the client.
  • Making a detection task that runs at on_ready which makes a request to /loadtracks and depending on the values determines if it's v2 or v3.

No Avaible Nodes

When I try to play a song it returns

in create
    raise NodeException('No available nodes!')
lavalink.exceptions.NodeException: No available nodes!

typo in link

Summary

typo in link at https://lavalink.readthedocs.io/en/latest/quickstart.html
example cog refers to https://github.cmo/Devoxin/Lavalink.py/blob/master/examples/music.py

Lavalink & System Version

not relevant

Reproduction

goto https://lavalink.readthedocs.io/en/latest/quickstart.html and click at example cog

Expected Results

https://github.com/Devoxin/Lavalink.py/blob/master/examples/music.py

Actual Results

https://github.cmo/Devoxin/Lavalink.py/blob/master/examples/music.py

Checklist

  • [x ] Have you checked that there aren't other open Bug Reports for the same problem?
  • Have you checked that your Lavalink password isn't visible?
  • Have you given a traceback if possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.