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 simple telegram bot to save restricted content with custom thumbmail support by Mahesh Chauhan

Save Restricted Content Bot A simple telegram bot to save restricted content with custom thumbmail support by Mahesh Chauhan. Variables API_ID API_HAS

Mahesh Chauhan 532 Jan 02, 2023
It's a simple python script to take backup of directories (compressing) then the same to move your mentioned S3 bucket with the help of AWS IAM User.

Directory Backup Moved to S3 (Pyscript) Description Here it's a python script that needs to use this script simply create a directory backup and moved

Yousaf K Hamza 3 Mar 04, 2022
Telegram File Renamer Bot

RENAMER_BOT Telegram File Renamer Bot Configs TG_BOT_TOKEN - Get bot token from @BotFather API_ID - From my.telegram.org API_HASH - From my.telegram.o

Lntechnical 37 Dec 27, 2022
A simple API wrapper for Discord written in Python.

AIOCord This project is work in progress not for production use A simple asynchronous API wrapper around Discord API written in Python. Inspiration Th

Izhar Ahmad 3 Dec 07, 2021
Multipurpose Discord bot hosted on replit.com

RockyBot Multipurpose Discord bot hosted on https://replit.com/ Installing Dependencies Install poetry through pip: pip install poetry Then simply exe

Rocky 2 May 18, 2022
A simple Discord Mass-Ban that's still working with Member Scraper.

Mass-Ban [!] This was made for education / you can use for revenge. Please don't skid it. [!] If you want to use it, please use member scraper before

WoahThatsHot 1 Nov 20, 2021
Battle.net and PlayStation title watcher that reports updates via Discord.

Renovate Renovate is a Battle.net and PlayStation title watcher that reports updates via Discord. Usage Open config_example.json and provide the confi

Ethan 1 Nov 23, 2022
Client to allow skytrack to be used with GSPro Golf simulator application

Skytrack Interface for GSPro A Basic Interface connection from Skytrack Launch Monitors to be able to play simulator golf via GSPro About The Project

James Peruggia 2 Oct 24, 2021
Advanced Number Validator Using telnyx api

Number Validator Python v1.0.0 Number Validator Using telnyx api DISCLAIMER This Tool is only for educational purposes You'll be responsible yourself

xBlackxCoder 3 Sep 24, 2022
discord voice bot to stream radio

Radio-Id Bot (Discord Voice Bot) Radio-id-bot (Radio Indonesia) is a simple Discord Music Bot built with discord.py to play a radio from some Indonesi

Adi Fahmi 20 Sep 20, 2022
Automated JSON API based communication with Fronius Symo

PyFronius - a very basic Fronius python bridge A package that connects to a Fronius device in the local network and provides data that is provided via

Niels Mündler 10 Dec 30, 2022
A Discord webhook spammer made in Python.

A Python made Discord webhook spammer usually used for token loggers to spam them/delete them original by cattyn I only made it so u can change the avatar to whatever u want instead of it being hardc

notperry1234567890 15 Dec 15, 2021
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 simple Discord bot that can fetch definitions and post them in chat.

A simple Discord bot that can fetch definitions and post them in chat. If you are connected to a voice channel, the bot will also read out the definition to you.

Tycho Bellers 4 Sep 29, 2022
🤖 Automated follow/unfollow bot for GitHub. Uses GitHub API. Written in python.

GitHub Follow Bot Table of Contents Disclaimer How to Use Install requirements Authenticate Get a GitHub Personal Access Token Add your GitHub usernam

João Correia 37 Dec 27, 2022
Infinity: a Twitter retweet bot that can be used by anyone

INSTAMATE Requires Firefox Instapy Python3 How To Use? Fork the repository Add your credentials in the bot.py file Save commits Clone your fork cd int

unofficialdxnny 3 Jun 23, 2022
PTV is a useful widget for trading view for doing paper trading when bar reply is enabled

PTV is a useful widget for trading view for doing paper trading when bar reply is enabled.(this feature did not implement in trading view)

Ali Moradi 39 Dec 26, 2022
Os-Remoter with Python (Telegram Bot)

Remote-Os Os-Remoter with Python (Telegram Bot) [1] First install "python -m pip install --upgrade pip" [2] Second install the modules inside file ins

Alisa Alikhani 2 Nov 09, 2022
Netflix Movies and TV Series Downloader Tool including CDM L1 which you guys can Donwload 4K Movies

NFRipper2.0 I could not shared all the code here Because its has lots of files inisde it https://new.gdtot.me/file/86651844 - Downoad File From Here.

Kiran 15 May 06, 2022
Scrapping malaysianpaygap & Extracting data from the Instagram posts

Scrapping malaysianpaygap & Extracting data from the posts Recently @malaysianpaygap has gotten quite famous as a platform that enables workers throug

Yudhiesh Ravindranath 65 Nov 09, 2022