https://github.com/ooliver1/mafic
A properly typehinted lavalink client for discord.py, nextcord, disnake and py-cord.
https://github.com/ooliver1/mafic
discord-py disnake disnake-py fully-typed lavalink lavalink-client lavalink-music lavalink-wrapper nextcord nextcord-py py-cord pycord python python3 typed wrapper
Last synced: about 2 months ago
JSON representation
A properly typehinted lavalink client for discord.py, nextcord, disnake and py-cord.
- Host: GitHub
- URL: https://github.com/ooliver1/mafic
- Owner: ooliver1
- License: mit
- Created: 2022-09-12T21:53:21.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-24T17:10:03.000Z (2 months ago)
- Last Synced: 2025-03-29T11:04:20.361Z (about 2 months ago)
- Topics: discord-py, disnake, disnake-py, fully-typed, lavalink, lavalink-client, lavalink-music, lavalink-wrapper, nextcord, nextcord-py, py-cord, pycord, python, python3, typed, wrapper
- Language: Python
- Homepage:
- Size: 373 KB
- Stars: 65
- Watchers: 2
- Forks: 8
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Mafic
[](https://github.com/ooliver1/mafic/blob/master/LICENSE "License File")
[](https://github.com/ooliver1/mafic/releases "Mafic Releases")
[](https://discord.gg/mMvUABNegY "Discord Server")
[](https://github.com/ooliver1/mafic/actions/workflows/lint.yml "Lint Workflow")
[](https://pypi.org/project/mafic "Mafic PyPI Project")
[](https://github.com/ooliver1/mafic/issues "Open Issues")
[](https://github.com/ooliver1/mafic/pulls "Open Pull Requests")
[](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 osimport mafic
import nextcord
from nextcord.ext import commandsclass 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="",
)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_clienttracks = 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(...)
```