# Mafic
[![MIT License](https://custom-icon-badges.demolab.com/github/license/ooliver1/mafic?color=845ec2&logo=code-square)](https://github.com/ooliver1/mafic/blob/master/LICENSE "License File")
[![Releases](https://custom-icon-badges.demolab.com/github/v/release/ooliver1/mafic?display_name=tag&include_prereleases&sort=semver&logo=commit&color=c25db8)](https://github.com/ooliver1/mafic/releases "Mafic Releases")
[![Discord](https://img.shields.io/discord/864563184919773226?color=f062a4&logo=discord&logoColor=white)](https://discord.gg/mMvUABNegY "Discord Server")
[![Lint Workflow Status](https://custom-icon-badges.demolab.com/github/actions/workflow/status/ooliver1/mafic/lint.yml?label=lint&logo=codescan-checkmark&color=ff738c)](https://github.com/ooliver1/mafic/actions/workflows/lint.yml "Lint Workflow")
[![PyPI - Status](https://img.shields.io/pypi/status/mafic?color=ff9075&label=PyPI&logo=pypi&logoColor=white)](https://pypi.org/project/mafic "Mafic PyPI Project")
[![Open Issues](https://custom-icon-badges.demolab.com/github/issues-raw/ooliver1/mafic?logo=issue-opened&color=ffb263)](https://github.com/ooliver1/mafic/issues "Open Issues")
[![Open PRs](https://custom-icon-badges.demolab.com/github/issues-pr-raw/ooliver1/mafic?logo=git-pull-request&color=ffd55f)](https://github.com/ooliver1/mafic/pulls "Open Pull Requests")
[![Read the Docs](https://img.shields.io/readthedocs/mafic?logo=read%20the%20docs&logoColor=white&color=f9f871)](https://mafic.readthedocs.io/en/latest/)
A properly typehinted lavalink client for discord.py, nextcord, disnake and py-cord.
## Installation
```bash
pip install mafic
```
> **Note**
> Use `python -m`, `py -m`, `python3 -m` or similar if that is how you install packages.
> Generally windows uses `py -m pip` and linux uses `python3 -m pip`
## Discord Server
[Join the Discord Server](https://discord.gg/mMvUABNegY) for support and updates.
## Documentation
[Read the docs](https://mafic.readthedocs.io/en/latest/).
## Features
- Fully customisable node balancing.
- Multi-node support.
- Filters.
- Full API coverage.
- Properly typehinted for Pyright strict.
## Usage
Go to the [Lavalink Repository](https://github.com/freyacodes/lavalink#server-configuration)
to set up a Lavalink node.
```python
import os
import mafic
import nextcord
from nextcord.ext import commands
class MyBot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.pool = mafic.NodePool(self)
self.loop.create_task(self.add_nodes())
async def add_nodes(self):
await self.pool.create_node(
host="127.0.0.1",
port=2333,
label="MAIN",
password="<password>",
)
bot = MyBot(intents=nextcord.Intents(guilds=True, voice_states=True))
@bot.slash_command(dm_permission=False)
async def play(inter: nextcord.Interaction, query: str):
if not inter.guild.voice_client:
player = await inter.user.voice.channel.connect(cls=mafic.Player)
else:
player = inter.guild.voice_client
tracks = await player.fetch_tracks(query)
if not tracks:
return await inter.send("No tracks found.")
track = tracks[0]
await player.play(track)
await inter.send(f"Playing {track.title}.")
bot.run(...)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ooliver1/mafic",
"name": "mafic",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "nextcord,disnake,discord,disnake.py,lavalink,lavalink.py,pycord,py-cord",
"author": "ooliver1",
"author_email": "oliverwilkes2006@icloud.com",
"download_url": "https://files.pythonhosted.org/packages/44/57/5c5e35b10896385f198011e15e6c3bc4d3579071ce62f8e541f6e70de713/mafic-2.10.0.tar.gz",
"platform": null,
"description": "# Mafic\n\n[![MIT License](https://custom-icon-badges.demolab.com/github/license/ooliver1/mafic?color=845ec2&logo=code-square)](https://github.com/ooliver1/mafic/blob/master/LICENSE \"License File\")\n[![Releases](https://custom-icon-badges.demolab.com/github/v/release/ooliver1/mafic?display_name=tag&include_prereleases&sort=semver&logo=commit&color=c25db8)](https://github.com/ooliver1/mafic/releases \"Mafic Releases\")\n[![Discord](https://img.shields.io/discord/864563184919773226?color=f062a4&logo=discord&logoColor=white)](https://discord.gg/mMvUABNegY \"Discord Server\")\n[![Lint Workflow Status](https://custom-icon-badges.demolab.com/github/actions/workflow/status/ooliver1/mafic/lint.yml?label=lint&logo=codescan-checkmark&color=ff738c)](https://github.com/ooliver1/mafic/actions/workflows/lint.yml \"Lint Workflow\")\n[![PyPI - Status](https://img.shields.io/pypi/status/mafic?color=ff9075&label=PyPI&logo=pypi&logoColor=white)](https://pypi.org/project/mafic \"Mafic PyPI Project\")\n[![Open Issues](https://custom-icon-badges.demolab.com/github/issues-raw/ooliver1/mafic?logo=issue-opened&color=ffb263)](https://github.com/ooliver1/mafic/issues \"Open Issues\")\n[![Open PRs](https://custom-icon-badges.demolab.com/github/issues-pr-raw/ooliver1/mafic?logo=git-pull-request&color=ffd55f)](https://github.com/ooliver1/mafic/pulls \"Open Pull Requests\")\n[![Read the Docs](https://img.shields.io/readthedocs/mafic?logo=read%20the%20docs&logoColor=white&color=f9f871)](https://mafic.readthedocs.io/en/latest/)\n\nA properly typehinted lavalink client for discord.py, nextcord, disnake and py-cord.\n\n## Installation\n\n```bash\npip install mafic\n```\n\n> **Note**\n> Use `python -m`, `py -m`, `python3 -m` or similar if that is how you install packages.\n> Generally windows uses `py -m pip` and linux uses `python3 -m pip`\n\n## Discord Server\n\n[Join the Discord Server](https://discord.gg/mMvUABNegY) for support and updates.\n\n## Documentation\n\n[Read the docs](https://mafic.readthedocs.io/en/latest/).\n\n## Features\n\n- Fully customisable node balancing.\n- Multi-node support.\n- Filters.\n- Full API coverage.\n- Properly typehinted for Pyright strict.\n\n## Usage\n\nGo to the [Lavalink Repository](https://github.com/freyacodes/lavalink#server-configuration)\nto set up a Lavalink node.\n\n```python\nimport os\n\nimport mafic\nimport nextcord\nfrom nextcord.ext import commands\n\n\nclass MyBot(commands.Bot):\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n\n self.pool = mafic.NodePool(self)\n self.loop.create_task(self.add_nodes())\n\n async def add_nodes(self):\n await self.pool.create_node(\n host=\"127.0.0.1\",\n port=2333,\n label=\"MAIN\",\n password=\"<password>\",\n )\n\n\nbot = MyBot(intents=nextcord.Intents(guilds=True, voice_states=True))\n\n\n@bot.slash_command(dm_permission=False)\nasync def play(inter: nextcord.Interaction, query: str):\n if not inter.guild.voice_client:\n player = await inter.user.voice.channel.connect(cls=mafic.Player)\n else:\n player = inter.guild.voice_client\n\n tracks = await player.fetch_tracks(query)\n\n if not tracks:\n return await inter.send(\"No tracks found.\")\n\n track = tracks[0]\n\n await player.play(track)\n\n await inter.send(f\"Playing {track.title}.\")\n\n\nbot.run(...)\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A properly typehinted lavalink client for discord.py, nextcord, disnake and py-cord.",
"version": "2.10.0",
"project_urls": {
"Homepage": "https://github.com/ooliver1/mafic",
"Repository": "https://github.com/ooliver1/mafic"
},
"split_keywords": [
"nextcord",
"disnake",
"discord",
"disnake.py",
"lavalink",
"lavalink.py",
"pycord",
"py-cord"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3e90e4a1ea7d8a8d1e2b436d1b85045fa5f012f6bcbf6f624af4808b0e67de1d",
"md5": "6f207be49bd19c0ea9965a1cdeb90830",
"sha256": "001214abaa92ebcaef321b297bd5b3386ae4ac29fc0f798770c403318062fcf8"
},
"downloads": -1,
"filename": "mafic-2.10.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6f207be49bd19c0ea9965a1cdeb90830",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 49634,
"upload_time": "2023-12-18T21:23:43",
"upload_time_iso_8601": "2023-12-18T21:23:43.110963Z",
"url": "https://files.pythonhosted.org/packages/3e/90/e4a1ea7d8a8d1e2b436d1b85045fa5f012f6bcbf6f624af4808b0e67de1d/mafic-2.10.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "44575c5e35b10896385f198011e15e6c3bc4d3579071ce62f8e541f6e70de713",
"md5": "0e66e79003a1562f7d70d91a655fb785",
"sha256": "dddec9e97808d231379583188286232d408face8b7b4eb3f16bf3c1d8ae8b5b0"
},
"downloads": -1,
"filename": "mafic-2.10.0.tar.gz",
"has_sig": false,
"md5_digest": "0e66e79003a1562f7d70d91a655fb785",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 42095,
"upload_time": "2023-12-18T21:23:46",
"upload_time_iso_8601": "2023-12-18T21:23:46.354017Z",
"url": "https://files.pythonhosted.org/packages/44/57/5c5e35b10896385f198011e15e6c3bc4d3579071ce62f8e541f6e70de713/mafic-2.10.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-18 21:23:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ooliver1",
"github_project": "mafic",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mafic"
}