devoxin / Lavalink.py

A wrapper for Lavalink in Python, which aims to be powerful and intuitive.
https://lavalink.readthedocs.io/
MIT License
223 stars 96 forks source link

Help with Music Bot Code #110

Closed ephiiPen closed 3 years ago

ephiiPen commented 3 years ago

@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!**
apex2504 commented 3 years ago

You're looking in the wrong place. This is the issue tracker for Lavalink.py, a wrapper for Lavalink. You're using ytdl/ffmpeg which is a completely different system entirely. You'd have better luck asking in https://discord.gg/dpy

oriapp commented 3 years ago

Wrong place to ask for help and not even related to Lavalink.py. Ask for help in discord.gg/dpy or discord.gg/python