pomice


Namepomice JSON
Version 2.9.0 PyPI version JSON
download
home_pagehttps://github.com/cloudwithax/pomice
SummaryThe modern Lavalink wrapper designed for Discord.py
upload_time2024-02-06 22:33:22
maintainer
docs_urlNone
authorcloudwithax
requires_python>=3.8
licenseGPL
keywords pomice lavalink discord.py
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pomice

![](https://raw.githubusercontent.com/cloudwithax/pomice/main/banner.jpg)


[![GPL](https://img.shields.io/github/license/cloudwithax/pomice?color=2f2f2f)](https://github.com/cloudwithax/pomice/blob/main/LICENSE) ![](https://img.shields.io/pypi/pyversions/pomice?color=2f2f2f) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Discord](https://img.shields.io/discord/899324069235810315?color=%237289DA&label=Pomice%20Support&logo=discord&logoColor=white)](https://discord.gg/r64qjTSHG8) [![Read the Docs](https://readthedocs.org/projects/pomice/badge/?version=latest)](https://pomice.readthedocs.io/en/latest/)


Pomice is a fully asynchronous Python library designed for communicating with [Lavalink](https://github.com/freyacodes/Lavalink) seamlessly within the [discord.py](https://github.com/Rapptz/discord.py) library. It features 100% coverage of the [Lavalink](https://github.com/freyacodes/Lavalink) spec that can be accessed with easy-to-understand functions along with Spotify and Apple Music querying capabilities using built-in custom clients, making it easier to develop your next big music bot.

## Quick Links
- [Discord Server](https://discord.gg/r64qjTSHG8)
- [Read the Docs](https://pomice.readthedocs.io/en/latest/)
- [PyPI Homepage](https://pypi.org/project/pomice/)


# Install
To install the library, you need the lastest version of pip and minimum Python 3.8

> Stable version
```
pip install pomice
```

> Unstable version (this one gets more frequent changes)
```
pip install git+https://github.com/cloudwithax/pomice
```

# Support And Documentation

The official documentation is [here](https://pomice.readthedocs.io/en/latest/)

You can join our support server [here](https://discord.gg/r64qjTSHG8)


# Examples
In-depth examples are located in the [examples folder](https://github.com/cloudwithax/pomice/tree/main/examples)

Here's a quick example:

```py
import pomice
import discord
import re

from discord.ext import commands

URL_REG = re.compile(r'https?://(?:www\.)?.+')

class MyBot(commands.Bot):

    def __init__(self) -> None:
        super().__init__(command_prefix='!', activity=discord.Activity(type=discord.ActivityType.listening, name='to music!'))

        self.add_cog(Music(self))

    async def on_ready(self) -> None:
        print("I'm online!")
        await self.cogs["Music"].start_nodes()


class Music(commands.Cog):

    def __init__(self, bot) -> None:
        self.bot = bot

        self.pomice = pomice.NodePool()

    async def start_nodes(self):
        await self.pomice.create_node(bot=self.bot, host='127.0.0.1', port='3030',
                                     password='youshallnotpass', identifier='MAIN')
        print(f"Node is ready!")



    @commands.command(name='join', aliases=['connect'])
    async def join(self, ctx: commands.Context, *, channel: discord.TextChannel = None) -> None:

        if not channel:
            channel = getattr(ctx.author.voice, 'channel', None)
            if not channel:
                raise commands.CheckFailure('You must be in a voice channel to use this command'
                                            'without specifying the channel argument.')


        await ctx.author.voice.channel.connect(cls=pomice.Player)
        await ctx.send(f'Joined the voice channel `{channel}`')

    @commands.command(name='play')
    async def play(self, ctx, *, search: str) -> None:

        if not ctx.voice_client:
            await ctx.invoke(self.join)

        player = ctx.voice_client

        results = await player.get_tracks(query=f'{search}')

        if not results:
            raise commands.CommandError('No results were found for that search term.')

        if isinstance(results, pomice.Playlist):
            await player.play(track=results.tracks[0])
        else:
            await player.play(track=results[0])


bot = MyBot()
bot.run("token here")
 ```

# FAQ
Why is it saying "Cannot connect to host"?

- You need to have a Lavalink node setup before you can use this library. Download it [here](https://github.com/freyacodes/Lavalink/releases/latest)

What experience do I need?

- This library requires that you have some experience with Python, asynchronous programming and the discord.py library.

Why is it saying "No module named pomice found"?

- You need to [install](#Install) the package before you can use it

# Contributors

- Thanks to [vveeps](https://github.com/vveeps) for implementing some features I wasn't able to do myself

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cloudwithax/pomice",
    "name": "pomice",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "pomice,lavalink,discord.py",
    "author": "cloudwithax",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/b6/dc/e8e4aa1fd3b6d558fbb6ea0e97af9bc7d331e378270546e20da949adf9c1/pomice-2.9.0.tar.gz",
    "platform": null,
    "description": "# Pomice\r\n\r\n![](https://raw.githubusercontent.com/cloudwithax/pomice/main/banner.jpg)\r\n\r\n\r\n[![GPL](https://img.shields.io/github/license/cloudwithax/pomice?color=2f2f2f)](https://github.com/cloudwithax/pomice/blob/main/LICENSE) ![](https://img.shields.io/pypi/pyversions/pomice?color=2f2f2f) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\r\n[![Discord](https://img.shields.io/discord/899324069235810315?color=%237289DA&label=Pomice%20Support&logo=discord&logoColor=white)](https://discord.gg/r64qjTSHG8) [![Read the Docs](https://readthedocs.org/projects/pomice/badge/?version=latest)](https://pomice.readthedocs.io/en/latest/)\r\n\r\n\r\nPomice is a fully asynchronous Python library designed for communicating with [Lavalink](https://github.com/freyacodes/Lavalink) seamlessly within the [discord.py](https://github.com/Rapptz/discord.py) library. It features 100% coverage of the [Lavalink](https://github.com/freyacodes/Lavalink) spec that can be accessed with easy-to-understand functions along with Spotify and Apple Music querying capabilities using built-in custom clients, making it easier to develop your next big music bot.\r\n\r\n## Quick Links\r\n- [Discord Server](https://discord.gg/r64qjTSHG8)\r\n- [Read the Docs](https://pomice.readthedocs.io/en/latest/)\r\n- [PyPI Homepage](https://pypi.org/project/pomice/)\r\n\r\n\r\n# Install\r\nTo install the library, you need the lastest version of pip and minimum Python 3.8\r\n\r\n> Stable version\r\n```\r\npip install pomice\r\n```\r\n\r\n> Unstable version (this one gets more frequent changes)\r\n```\r\npip install git+https://github.com/cloudwithax/pomice\r\n```\r\n\r\n# Support And Documentation\r\n\r\nThe official documentation is [here](https://pomice.readthedocs.io/en/latest/)\r\n\r\nYou can join our support server [here](https://discord.gg/r64qjTSHG8)\r\n\r\n\r\n# Examples\r\nIn-depth examples are located in the [examples folder](https://github.com/cloudwithax/pomice/tree/main/examples)\r\n\r\nHere's a quick example:\r\n\r\n```py\r\nimport pomice\r\nimport discord\r\nimport re\r\n\r\nfrom discord.ext import commands\r\n\r\nURL_REG = re.compile(r'https?://(?:www\\.)?.+')\r\n\r\nclass MyBot(commands.Bot):\r\n\r\n    def __init__(self) -> None:\r\n        super().__init__(command_prefix='!', activity=discord.Activity(type=discord.ActivityType.listening, name='to music!'))\r\n\r\n        self.add_cog(Music(self))\r\n\r\n    async def on_ready(self) -> None:\r\n        print(\"I'm online!\")\r\n        await self.cogs[\"Music\"].start_nodes()\r\n\r\n\r\nclass Music(commands.Cog):\r\n\r\n    def __init__(self, bot) -> None:\r\n        self.bot = bot\r\n\r\n        self.pomice = pomice.NodePool()\r\n\r\n    async def start_nodes(self):\r\n        await self.pomice.create_node(bot=self.bot, host='127.0.0.1', port='3030',\r\n                                     password='youshallnotpass', identifier='MAIN')\r\n        print(f\"Node is ready!\")\r\n\r\n\r\n\r\n    @commands.command(name='join', aliases=['connect'])\r\n    async def join(self, ctx: commands.Context, *, channel: discord.TextChannel = None) -> None:\r\n\r\n        if not channel:\r\n            channel = getattr(ctx.author.voice, 'channel', None)\r\n            if not channel:\r\n                raise commands.CheckFailure('You must be in a voice channel to use this command'\r\n                                            'without specifying the channel argument.')\r\n\r\n\r\n        await ctx.author.voice.channel.connect(cls=pomice.Player)\r\n        await ctx.send(f'Joined the voice channel `{channel}`')\r\n\r\n    @commands.command(name='play')\r\n    async def play(self, ctx, *, search: str) -> None:\r\n\r\n        if not ctx.voice_client:\r\n            await ctx.invoke(self.join)\r\n\r\n        player = ctx.voice_client\r\n\r\n        results = await player.get_tracks(query=f'{search}')\r\n\r\n        if not results:\r\n            raise commands.CommandError('No results were found for that search term.')\r\n\r\n        if isinstance(results, pomice.Playlist):\r\n            await player.play(track=results.tracks[0])\r\n        else:\r\n            await player.play(track=results[0])\r\n\r\n\r\nbot = MyBot()\r\nbot.run(\"token here\")\r\n ```\r\n\r\n# FAQ\r\nWhy is it saying \"Cannot connect to host\"?\r\n\r\n- You need to have a Lavalink node setup before you can use this library. Download it [here](https://github.com/freyacodes/Lavalink/releases/latest)\r\n\r\nWhat experience do I need?\r\n\r\n- This library requires that you have some experience with Python, asynchronous programming and the discord.py library.\r\n\r\nWhy is it saying \"No module named pomice found\"?\r\n\r\n- You need to [install](#Install) the package before you can use it\r\n\r\n# Contributors\r\n\r\n- Thanks to [vveeps](https://github.com/vveeps) for implementing some features I wasn't able to do myself\r\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "The modern Lavalink wrapper designed for Discord.py",
    "version": "2.9.0",
    "project_urls": {
        "Homepage": "https://github.com/cloudwithax/pomice"
    },
    "split_keywords": [
        "pomice",
        "lavalink",
        "discord.py"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b39f71054ec7844a9b75256d997f71f326014694f7e57a4e4e1b7c9571691c5",
                "md5": "5a5ffe100aff8b25e0a45db7bcc358b0",
                "sha256": "72aab7817c7e3bedc9d90aa1cb6f59cd606e4394cfa90bf0ad3d4acc8a095b6c"
            },
            "downloads": -1,
            "filename": "pomice-2.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a5ffe100aff8b25e0a45db7bcc358b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 53896,
            "upload_time": "2024-02-06T22:33:21",
            "upload_time_iso_8601": "2024-02-06T22:33:21.152675Z",
            "url": "https://files.pythonhosted.org/packages/2b/39/f71054ec7844a9b75256d997f71f326014694f7e57a4e4e1b7c9571691c5/pomice-2.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6dce8e4aa1fd3b6d558fbb6ea0e97af9bc7d331e378270546e20da949adf9c1",
                "md5": "b737f01d7e014268ee9bb4df390b284a",
                "sha256": "93b0b41ac549507d78dff91bae7adcdda6e49599b46444e8cd378fc50cd637c1"
            },
            "downloads": -1,
            "filename": "pomice-2.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b737f01d7e014268ee9bb4df390b284a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 50551,
            "upload_time": "2024-02-06T22:33:22",
            "upload_time_iso_8601": "2024-02-06T22:33:22.523918Z",
            "url": "https://files.pythonhosted.org/packages/b6/dc/e8e4aa1fd3b6d558fbb6ea0e97af9bc7d331e378270546e20da949adf9c1/pomice-2.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-06 22:33:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cloudwithax",
    "github_project": "pomice",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pomice"
}
        
Elapsed time: 0.17443s