Maintained wavelink fork for pycord

Overview

Pycord.Wavelink

Wavelink is robust and powerful Lavalink wrapper for Pycord! Wavelink features a fully asynchronous API that's intuitive and easy to use.

Support

For support using Pycord.WaveLink, please join the official support server on Discord.

Discord

Installation

The following commands are currently the valid ways of installing WaveLink.

WaveLink requires Python 3.8+

Windows

py -3.9 -m pip install pycord.wavelink --pre

Linux

python3.9 -m pip install pycord.wavelink --pre

Getting Started

A quick and easy bot example:

import pycord.wavelink as wavelink
from discord.ext import commands

class Bot(commands.Bot):
    def __init__(self):
        super().__init__(command_prefix='>?')

    async def on_ready(self):
        print('Bot is ready!')

class Music(commands.Cog):
    """Music cog to hold Wavelink related commands and listeners."""
    def __init__(self, bot: commands.Bot):
        self.bot = bot
        bot.loop.create_task(self.connect_nodes())

    async def connect_nodes(self):
        """Connect to our Lavalink nodes."""
        await self.bot.wait_until_ready()
        await wavelink.NodePool.create_node(
            bot=bot,
            host='0.0.0.0',
            port=2333,
            password='YOUR_LAVALINK_PASSWORD',
        )

    @commands.Cog.listener()
    async def on_wavelink_node_ready(self, node: wavelink.Node):
        """Event fired when a node has finished connecting."""
        print(f'Node: <{node.identifier}> is ready!')

    @commands.command()
    async def play(self, ctx: commands.Context, *, search: wavelink.YouTubeTrack):
        """Play a song with the given search query.
        If not connected, connect to our voice channel.
        """
        if not ctx.voice_client:
            vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
        else:
            vc: wavelink.Player = ctx.voice_client
        await vc.play(search)

bot = Bot()
bot.add_cog(Music(bot))
bot.run('YOUR_BOT_TOKEN')
Comments
  • Make Pycord.Wavelink a Pycord extension

    Make Pycord.Wavelink a Pycord extension

    Summary

    This will move all files into the discord/ext/wavelink namespace. This is a way better implementation than the current one. It also allows seamless migration from the original library without using an alias when importing wavelink.

    Following was tested:

    • Installation
    • Playing a track

    Docs Build wasn't tested.

    Checklist

    • [x] If code changes were made then they have been tested.
      • [x] I have updated the documentation to reflect the changes.
    • [ ] If type: ignore comments were used, a comment is also left explaining why
    • [x] This PR fixes an issue. #15
    • [ ] This PR adds something new (e.g. new method or parameters).
    • [x] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ ] This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)

    Further possible improvements

    To reflect this change, the pypi name and GitHub repo should be renamed to pycord-ext-wavelink or py-cord-ext-wavelink.

    Due to the early state of the library it should be possible and all users would adapt to this change.

    opened by Luc1412 16
  • Make wavelink a pycord extension

    Make wavelink a pycord extension

    I think a smart implementation of this library would be as an extension by moving it into the discord/ext/wavelink namespace.

    Also the library name currently is a bit unconventional. pycord-ext-wavelink or py-cord-ext-wavelink would be better by following the naming conventions from Danny (menu extension)

    opened by Luc1412 4
  • Revert

    Revert "Improve the connect, move, and is_connected methods"

    Reverts Pycord-Development/Pycord.Wavelink#34

    The library seems to have broken after the mentioned PR. 1 previous version works perfectly without any code changes

    Error-

    Traceback (most recent call last):
      File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 179, in wrapped
        ret = await coro(*args, **kwargs)
      File "/home/container/Cogs/Music.py", line 142, in play
        await vc.play(vc.queue.get())
      File "/home/container/.local/lib/python3.10/site-packages/pycord/wavelink/player.py", line 247, in play
        "guildId": str(self.guild.id),
      File "/home/container/.local/lib/python3.10/site-packages/pycord/wavelink/player.py", line 107, in guild
        return self.channel.guild
    AttributeError: 'NoneType' object has no attribute 'guild'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 335, in invoke
        await ctx.command.invoke(ctx)
      File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 916, in invoke
        await injected(*ctx.args, **ctx.kwargs)
      File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 188, in wrapped
        raise CommandInvokeError(exc) from exc
    discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'guild'
    
    opened by Om1609 2
  • VOICE_SERVER_UPDATE and VOICE_STATE_UPDATE events of discord are not dispatched to lavalink

    VOICE_SERVER_UPDATE and VOICE_STATE_UPDATE events of discord are not dispatched to lavalink

    No song is playing on the channel after the client sends the request and the server is sending connected: False in websocket event.

    2022-02-08 15:25:43,642 - pycord.wavelink.websocket - op: event:: {'op': 'event', 'type': 'TrackStartEvent', 'track': 'QAAAkgIALExpb25lbCBSaWNoaWUgLSBIZWxsbyAoT2ZmaWNpYWwgTXVzaWMgVmlkZW8pAAxsaW9uZWxyaWNoaWUAAAAAAAT9WAALbUhPTk5jWmJ3RFkAAQAraHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1tSE9OTmNaYndEWQAHeW91dHViZQAAAAAAAAAA', 'guildId': '822344738958344204'}
    2022-02-08 15:25:48,459 - pycord.wavelink.websocket - Received Payload:: <{"op":"playerUpdate","state":{"connected":false,"position":0,"time":1644314148103},"guildId":"822344738958344204"}>
    2022-02-08 15:25:48,461 - pycord.wavelink.websocket - op: playerUpdate:: {'op': 'playerUpdate', 'state': {'connected': False, 'position': 0, 'time': 1644314148103}, 'guildId': '822344738958344204'}
    2022-02-08 15:25:53,581 - pycord.wavelink.websocket - Received Payload:: <{"op":"playerUpdate","state":{"connected":false,"position":0,"time":1644314153102},"guildId":"822344738958344204"}>
    2022-02-08 15:25:53,584 - pycord.wavelink.websocket - op: playerUpdate:: {'op': 'playerUpdate', 'state': {'connected': False, 'position': 0, 'time': 1644314153102}, 'guildId': '822344738958344204'}
    2022-02-08 15:25:58,378 - pycord.wavelink.websocket - Received Payload:: <{"op":"playerUpdate","state":{"connected":false,"position":0,"time":1644314158102},"guildId":"822344738958344204"}>
    2022-02-08 15:25:58,380 - pycord.wavelink.websocket - op: playerUpdate:: {'op': 'playerUpdate', 'state': {'connected': False, 'position': 0, 'time': 1644314158102}, 'guildId': '822344738958344204'}
    
    
    opened by TheShubhendra 2
  • Bug in Node.get_player

    Bug in Node.get_player

       async def get_player(self, obj: Union[ApplicationContext, discord.Guild]):
            if isinstance(obj, ApplicationContext):
                obj = obj.guild
            print(wavelink.NodePool._nodes)
            for node in wavelink.NodePool._nodes.values():
                player = node.get_player(obj)
                if player is not None:
                    return player
            if player is None:
                player = Player(obj)
            return player 
    

    I am trying to retrieve the player from the Pool using the above code but it's returning me the following error.

       player = node.get_player(obj)
      File "/home/pi/.local/lib/python3.10/site-packages/pycord/wavelink/pool.py", line 308, in get_player
        if player.guild == guild:
      File "/home/pi/.local/lib/python3.10/site-packages/pycord/wavelink/player.py", line 107, in guild
        return self.channel.guild
    AttributeError: 'NoneType' object has no attribute 'guild'
    
    opened by TheShubhendra 1
  • Missing some Wavelink objects

    Missing some Wavelink objects

    wavelink.Client, wavelink.eqs.Equalizer, wavelink.meta.WavelinkMixin, and wavelink.events (such as wavelink.events.TrackEnd) were not brought over into the pycord version of wavelink

    invalid wontfix 
    opened by KosmicAnomaly 1
  • `SoundCloudTrack` Always Raises `BadArgument`

    `SoundCloudTrack` Always Raises `BadArgument`

    Summary

    Every time I search for a song in SoundCloud with wavelink.SoundCloudTrack, it never returns anything. Rather, it raises a BadArgument exception stating that it could not find any songs matching that query.

    Reproduction Steps

    1. Run the Minimal Reproducible Code
    2. Join a VC that your bot can join
    3. Run the play command with your query of choice

    Minimal Reproducible Code

    Use the example code but replace the type annotation for the search argument from wavelink.YouTubeTrack to wavelink.SoundCloudTrack.

    Expected Results

    The bot would join the VC and play the song from a lavalink server's SoundCloud search with the query

    Actual Results

    Ignoring exception in command play:
    Traceback (most recent call last):
      File "ProjectDir/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 335, in invoke
        await ctx.command.invoke(ctx)
      File "ProjectDir/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 902, in invoke
        await self.prepare(ctx)
      File "ProjectDir/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 832, in prepare
        await self._parse_arguments(ctx)
      File "ProjectDir/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 747, in _parse_arguments
        kwargs[name] = await self.transform(ctx, param)
      File "ProjectDir/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 590, in transform
        return await run_converters(ctx, converter, argument, param)  # type: ignore
      File "ProjectDir/venv/lib/python3.8/site-packages/discord/ext/commands/converter.py", line 1183, in run_converters
        return await _actual_conversion(ctx, converter, argument, param)
      File "ProjectDir/venv/lib/python3.8/site-packages/discord/ext/commands/converter.py", line 1075, in _actual_conversion
        return await converter.convert(ctx, argument)
      File "ProjectDir/pycord/wavelink/tracks.py", line 203, in convert
        raise commands.BadArgument("Could not find any songs matching that query.")
    discord.ext.commands.errors.BadArgument: Could not find any songs matching that query.
    

    Intents

    None

    System Information

    Since I couldn't install the latest version, I, instead, cloned this repository to the latest commit (edaf4d7caedf797852d82d3e08faec9d89997ab7) and dragged the source code (the pycord directory inside of src) to the root project directory.

    - Python 3.8.5
    - py-cord v2.0.0-alpha
        - py-cord pkg_resources: v2.0.0a4688+g52fdbb1b
    - aiohttp v3.7.4.post0
    - system information: Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64
    
    opened by Makiyu-py 1
  • Get Spotify Tracks from YTMusic instead of YT

    Get Spotify Tracks from YTMusic instead of YT

    Summary

    YouTube Music searches and returns Soundtracks before Music videos. Due to this nature, the quality tends to be better on Youtube Music searches.

    Since Spotify is also primarily soundtracks based music streaming service, getting tracks from YTM seems more logical.

    I've tested it to an extent. And the initial results look promising. This should be implemented in conjunction to #24

    Checklist

    • [x] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [ ] If type: ignore comments were used, a comment is also left explaining why
    • [] This PR fixes an issue.
    • [x] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ ] This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)
    opened by Om1609 0
  • Add PlainTrack to __all__

    Add PlainTrack to __all__

    Summary

    Add PlainTrack to the __all__ variable so it is recognised by IDEs I'm not sure how it affected the working of the object earlier, but now the code does work 😅

    Checklist

    • [x] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [ ] If type: ignore comments were used, a comment is also left explaining why
    • [x] This PR fixes an issue.
    • [ ] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ ] This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)
    opened by Om1609 0
  • Subclass YTM Track from YT Track

    Subclass YTM Track from YT Track

    So apparently songs on YouTube music are there on Youtube too, with the exact same video id. In fact, Youtube Music is just a layer on top of Youtube.

    Subclassing YTM Track from YT Track gives it the thumbnail property. It is used to get the thumbnail of the video

    opened by Om1609 0
  • Create an attribute named self deafen

    Create an attribute named self deafen

    If you know many music bots use self deafen method to deafen them. I know we can manually deafen the bots in the server but it looks cool when the bot is on self deafen, so i will suggest to add an attribute named selfdeafen.

    opened by TheRealShreyash 1
  • Age Restricted Content Unplayable (YouTube)

    Age Restricted Content Unplayable (YouTube)

    Age Restricted content on YouTube appears to be unplayable currently. Lavalink shows that it loads whatever Age-Restricted video you throw at it, but there is no audio outputted by the bot.

    opened by remiteeple 0
Releases(1.0.0-dev)
Owner
Pycord Development
A team of developers working on maintaining pycord. Owned by @BobDotCom
Pycord Development
A Bot, which observes your counting-abilities and controls your drinking-habits, too!

Discord Counting Bot with Beer-Counter Heavily inspired by AlexVerricos Counting_bot, but adjusted a lot for the beer drinking habits of students. Inv

Jakob Jung 3 Oct 18, 2022
twtxt is a decentralised, minimalist microblogging service for hackers.

twtxt twtxt is a decentralised, minimalist microblogging service for hackers. So you want to get some thoughts out on the internet in a convenient and

buckket 1.8k Jan 09, 2023
Bot simply search for the files from provided channel according to given query and gives link to those files as buttons!

Auto Filter Bot ㅤㅤㅤㅤㅤㅤㅤ ㅤㅤㅤㅤㅤㅤㅤ You can call this as an Auto Filter Bot if you like :D Bot simply search for the files from provided channel according

TroJanzHEX 89 Nov 23, 2022
Raid ToolBox (RTB) is a big toolkit of Spamming/Raiding/Token management tools for discord.

This code is very out of date and not very good, feel free to make it into something better. (we check the github page every 5 years to pulls your PRs

2 Oct 03, 2021
A github actions + python code to extract URLs to code repositories to put into standard form, starting with github

A github actions + python code to extract URLs to code repositories to put into standard form, starting with github ---- NOTE: JUS

Justin Gosses 2 Nov 15, 2021
Clisd.py - UI framework with client side rendering for python

clisd.py Clisd is UI framework with client side rendering for python. It uses WA

2 Mar 25, 2022
Install and manage Proton-GE and Luxtorpeda for Steam and Wine-GE for Lutris with this graphical user interface. Based on AUNaseef's ProtonUp, made with Python 3 and Qt 6.

ProtonUp-Qt Qt-based graphical user interface to install and manage Proton-GE installations for Steam and Wine-GE installations for Lutris. Based on A

638 Jan 02, 2023
A media upload to telegraph module

A media upload to telegraph module

Fayas Noushad 5 Dec 01, 2021
Telegram hack bot [ For Dev ]

Telegram hack bot [ For Dev ]

Alison Parker 1 Jul 04, 2022
A tiktok mass account creator with undetected selenium and email verification, to bot an account

⚠️ STILL UNDER DEVELOPEMENT - v1.1-beta ⚠️ Adding PROXY ROTATION Adding EMAIL VERIFICATION Adding USERNAME COMPILER Tiktok Mass Bot Creator v1.1-beta

xtekky 11 Aug 01, 2022
🖥️ Python - P1 Monitor API Asynchronous Python Client

🖥️ Asynchronous Python client for the P1 Monitor

Klaas Schoute 9 Dec 12, 2022
Github integration with Telegram

The Telegram bot myGit is your GiHub assistant. In your conversations with your team, you can simply insert the information about the projects you are working at.

Alexandru Buzescu 2 Jan 06, 2022
Telegram Group Manager Bot Written In Python Using Pyrogram.

──「𝐂𝐡𝐢𝐤𝐚 𝐅𝐮𝐣𝐢𝐰𝐚𝐫𝐚」── Telegram Group Manager Bot Written In Python Using Pyrogram. Deploy To Heroku NOTE: I'm making this note to whoever

Wahyusaputra 3 Feb 12, 2022
Discord raiding tool. Made in python 3.9

XSpammer Discord raiding tool with 20 features. YT Showcase Requirements/Installation Python 3.7+ [https://python.org] Run setup.bat to install the es

Tiie 6 Oct 24, 2022
OSINT tool to get information from a Github and Gitlab profile and find user's email addresses leaked on commits.

gitrecon OSINT tool to get information from a Github or Gitlab profile and find user's email addresses leaked on commits. 📚 How does this work? GitHu

GOΠZO 211 Dec 17, 2022
Discord bot that performs various functions.

rikka-bot A Discord bot that performs various functions. Table of Contents Commands Main Commands Utility Commands Admin Commands Self-Assignable Role

Carlos Saucedo 7 Aug 27, 2021
The purpose of this bot is to take soundcloud track requests, that are posted in the stream-requests channel, and add them to a playlist, to make the process of scrolling through the requests easier for Root

Discord Song Collector Dont know if anyone is actually going to read this, but the purpose of this bot is to check every message in the stream-request

2 Mar 01, 2022
⚡ PoC: Hide a c&c botnet in the discord client. (Proof Of Concept)

👨‍💻 Discord Self Bot 👨‍💻 A Discord Self-Bot in Python by natrix Installation Run: selfbot.bat Python: version : 3.8 Modules

0хVιcнy#1337 37 Oct 21, 2022
Talon accessibility - Experimental Talon integrations using macOS accessibility APIs

talon_accessibility Experimental Talon integrations using macOS accessibility AP

Phil Cohen 11 Dec 23, 2022
Music bot for Discord

Treble Music bot for Discord Youtube is after music bots on Discord. So we are here to fill the void. Introducing Treble, the next generation of Disco

Aja Khanal 0 Sep 16, 2022