Mafic
A properly typehinted lavalink client for discord.py, nextcord, disnake and py-cord.
Installation
pip install mafic
Note Use
python -m,py -m,python3 -mor similar if that is how you install packages. Generally windows usespy -m pipand linux usespython3 -m pip
Discord Server
Join the Discord Server for support and updates.
Documentation
Features
- Fully customisable node balancing.
- Multi-node support.
- Filters.
- Full API coverage.
- Properly typehinted for Pyright strict.
Usage
Go to the Lavalink Repository to set up a Lavalink node.
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(...)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mafic-2.11.0.tar.gz
(41.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
mafic-2.11.0-py3-none-any.whl
(49.8 kB
view details)
File details
Details for the file mafic-2.11.0.tar.gz.
File metadata
- Download URL: mafic-2.11.0.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82309ff08fff91dd6521dda4fe533c7f93b19d3bfa8ade7bdedf4af9f0da8a6e
|
|
| MD5 |
5a4f1987808cb71d17427233e55d63c4
|
|
| BLAKE2b-256 |
0ec7c96f55278a3626749933eb965322bb48f212b3c08edaa7c8b377078513f0
|
File details
Details for the file mafic-2.11.0-py3-none-any.whl.
File metadata
- Download URL: mafic-2.11.0-py3-none-any.whl
- Upload date:
- Size: 49.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80fc658c3103035bfd04533c9d3f9bd25d38b000e3a2dd2ea7a0c1e9c50f4168
|
|
| MD5 |
e741437367aaa616f4fceed18c697850
|
|
| BLAKE2b-256 |
5307495c766d86d99017442fe75e88f11c2fcf221dfb45151fff9c713ead8f17
|