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
Sakamata-alpha-pycord - Sakamata bot alpha with pycord

sakamatabot このリポジトリは? ホロライブ所属VTuber沙花叉クロヱさんの非公式ファンDiscordサーバー「クロヱ水族館」の運営/管理補助を行う

sushichaaaan 1 May 4, 2022
A maintained fork of Danny's discord.py

Nextcord A modern, easy-to-use, feature-rich, and async-ready API wrapper for Discord written in Python. Fork notice This is a fork of discord.py, whi

null 977 Jan 5, 2023
Maintained Fork of Jishaku For nextcord

Onami a debugging and utility extension for nextcord bots Read the documentation online. Fork Onami is a actively maintained fork of Jishaku for nextc

RPS 11 Dec 14, 2022
PyDiscord, a maintained fork of discord.py, is a python wrapper for the Discord API.

discord.py A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. The Future of discord.py Please read the gi

Omkaar 1 Jan 16, 2022
Robocord is a bot created for the Pycord community.

Robocord is a bot created for the community of the Pycord Server. Just a bot created for Pycord Server. You can start pull requests, I will check it and if its good I will add it to the bot. ??

Bruce 7 Jun 26, 2022
A Discord Bot created using Pycord!

Hey, I am Slash Bot. A Bot which works with Slash Commands! Prerequisites Python 3+ Check out. the requirements.txt and install all the pakages. Insta

Saumya Patel 1 Nov 29, 2021
A Slash Commands Discord Bot created using Pycord!

Hey, I am Slash Bot. A Bot which works with Slash Commands! Prerequisites Python 3+ Check out. the requirements.txt and install all the pakages. Insta

Saumya Patel 18 Nov 15, 2022
YuuScource - A Discord bot made with Pycord

Yuu A Discord bot made with Pycord Features Not much lol • Easy to use commands

kekda 9 Feb 17, 2022
A template that help you getting started with Pycord.

A Pycord Template with some example! Getting Started: Clone this repository using git clone https://github.com/AungS8430/pycord-template.git If you ha

null 2 Feb 10, 2022
null 5 Oct 19, 2022
Actively maintained, pure Python wrapper for the Twitter API. Supports both normal and streaming Twitter APIs.

Twython Twython is a Python library providing an easy way to access Twitter data. Supports Python 3. It's been battle tested by companies, educational

Ryan McGrath 1.9k Jan 2, 2023
Home Assistant custom integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, officially maintained by the Tuya Developer Team.

Tuya Home Assistant Integration Home Assistant custom integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, officially mainta

Tuya 704 Jan 3, 2023
Powerful Telegram Maintained UserBot in Telethon

Fire-X UserBot The Awaited Bot Fire-X userbot The Most Powerful Telegram Userbot. This Userbot is Safe to use in Your Telegram Account. It is not like

null 22 Oct 21, 2022
DragDev Maintained Instance Of discord.py

discord.py - DragDev Flavour A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. The Future of discord.py

DragDev Studios 3 Aug 27, 2022
An API wrapper for discord; maintained and improved from discord.py

Fusion.py Documentation What is Fusion.py you might ask; Fusion.py is a Discord.py fork that has most of the good features from most of the big Discor

Senarc Studios 5 Apr 19, 2022
Elkeid HUB - A rule/event processing engine maintained by the Elkeid Team that supports streaming/offline data processing

Elkeid HUB - A rule/event processing engine maintained by the Elkeid Team that supports streaming/offline data processing

Bytedance Inc. 61 Dec 29, 2022
pymobiledevice fork with more recent coding standards and many more features

Description Features Installation Usage Sending your own messages Lockdown messages Instruments messages Example Lockdown services com.apple.instrumen

null 255 Dec 28, 2022
An Inline Telegram YouTube Downloader bot with custom, permanent thumbnail support and cancel upload facility. Make your fork now.

Inline-Tube-Mate (YouTube Downloader) An Inline Telegram bot that can download YouTube videos with permanent thumbnail support Bot need to be in Inlin

Renjith Mangal 41 Dec 14, 2022
A Fork of Gitlab's Permifrost tool for managing Snowflake Permissions

permifrost-fork This is a fork of the GitLab permifrost project. As the GitLab team is not currently maintaining the project, we've taken on maintenac

Hightouch 7 Oct 13, 2021