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 Telegram Bot for searching any channel messages from Inline by @AbirHasan2005

Message-Search-Bot A Telegram Bot for searching any channel messages from Inline by @AbirHasan2005. I made this for @AHListBot. You can use this for s

Abir Hasan 44 Dec 27, 2022
Auto-commiter - Auto commiter Github

auto committer Github Follow the steps below to use this repository: 1-install c

Arman Ebtekari 8 Nov 14, 2022
A Telegram Bot which will ask new Group Members to verify them by solving an emoji captcha.

Emoji-Captcha-Bot A Telegram Bot which will ask new Group Members to verify them by solving an emoji captcha. About API: Using api.abirhasan.wtf/captc

Abir Hasan 52 Dec 11, 2022
An accessible Archive of Our Own reader application written in python.

AO3-A11y. Important disclaimer. This project is under active development. Many features might not yet be present, or some things might not work at all

4 Nov 11, 2022
DISCORD script to automate sending messages to a particular server

discord discord script This script sends random quotes to an discord server and tags random users on the server in the process MADE WITH LOVE BY SACS

Solomon ogu 1 Nov 06, 2021
Telegram bot to provide Telegram user/group/channel information

Whois-TeLeTiPs Telegram bot to provide Telegram user/group/channel information Deployment Methods Heroku Config Vars API_ID : Telegram API_ID, get it

11 Oct 21, 2022
🐍 Mnemonic code for generating deterministic keys, BIP39

python-mnemonic 🐍 Mnemonic code for generating deterministic keys, BIP39 Installation To install this library and its dependencies use: pip install m

9 Dec 22, 2022
🪣 Bitbucket Server PAT Generator

🪣 Bitbucket Server PAT Generator 🤝 Introduction Bitbucket Server (nee Stash) can hand out Personal Access Tokens (PAT) to be used in-place of user+p

reecetech 2 May 03, 2022
A secure and customizable bot for controlling cross-server announcements and interactions within Discord

DiscordBot A secure and customizable bot for controlling cross-server announcements and interactions within Discord. Within the code of the bot, you c

Jacob Dorfmeister 1 Jan 22, 2022
wrapper for facebook messenger

pyfacebook pyfacebook library for python. Requirements common Help Got a question? File a GitHub issue. Contributing Bug Reports & Feature Requests Pl

Luis Mayta 3 Nov 12, 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
Nonebot2 简易群管

简易群管 ✨ NoneBot2 简易群管 ✨ _ 踢 改 禁 欢迎issue pr 权限说明:permission=SUPERUSER 安装 💿 pip install nonebot-plugin-admin 导入 📲 在bot.py 导入,语句: nonebot.load_plugin("n

幼稚园园长 74 Dec 22, 2022
Telegram Voice Chat UserBot made with Pyrogram and MarshalX/tgcalls with playlist and Heroku support

Telegram Voice Chat UserBot A Telegram UserBot to Play Audio in Voice Chats. This is also the source code of the userbot which is being used for playi

Calls Music 164 Nov 12, 2022
Starlink Order Status Notification

Starlink Order Status Notification This script logs into Starlink order portal, pulls your estimated delivery date and emails it to a designated email

Aaron R. 1 Jul 08, 2022
This repository contains code written in the AWS Cloud Development Kit (CDK)

This repository contains code written in the AWS Cloud Development Kit (CDK) which launches infrastructure across two different regions to demonstrate using AWS AppSync in a multi-region setup.

AWS Samples 5 Jun 03, 2022
The EscapePod Python SDK for Cyb3rVector's EscapePod Extension Proxy

EscapePod Extension SDK for Python by cyb3rdog This is the EscapePod Python SDK for Cyb3rVector's EscapePod Extension Proxy. With this SDK, you can: m

cyb3rdog 3 Mar 07, 2022
Some 3Commas helper bots, AltRank, GalaxyScore, Watchlist, Auto-Compound

3Commas Cyber Bot Helpers A collection of 3Commas bot helpers I wrote. (collection will grow over time) Disclaimer THE SOFTWARE IS PROVIDED "AS IS", W

Ron Klinkien 176 Jan 02, 2023
Anti-corruption-bot - Anti corruption bot with python

anti-corruption-bot Test API (running via Flask) is currently hosted at https://

Richard Bankole 2 Feb 16, 2022
A simple Python TDLib wrapper

Telegram Forwarder App Description pywtdlib (Python Wrapper TDLib) is a simple synchronous Python wrapper that makes you easy to create new Python Tel

Álvaro Fernández 2 Jan 04, 2023
NFTs Upload to OpenSea CuseEdition

NFTs-Upload-to-OpenSea-CuseEdition YOUTUBE VIDEO - Soon... Download Python and

Lil Cuse 2 Jan 04, 2022