A properly typehinted lavalink client for discord.py, nextcord, disnake and py-cord.
Project description
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(...)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file mafic-2.10.1.tar.gz.
File metadata
- Download URL: mafic-2.10.1.tar.gz
- Upload date:
- Size: 41.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47a8ebe9011931a756b9d47a5fd1cd50760a6c8f07bef70c683b3419bd54474b
|
|
| MD5 |
d3dcc0db61b77ad5d3dce29dbffe692d
|
|
| BLAKE2b-256 |
1f5e4dae6572b1f865f07051e3281819e7e5737e904c1caae01e7713f3a01368
|
File details
Details for the file mafic-2.10.1-py3-none-any.whl.
File metadata
- Download URL: mafic-2.10.1-py3-none-any.whl
- Upload date:
- Size: 49.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fba783e00d2388025e3e62ada845848bc24c89a4404b3fee73f2640647c7d2f0
|
|
| MD5 |
9a0b1e6e09a9bc0ed2edc2e9dd05606b
|
|
| BLAKE2b-256 |
bb5953a9178fdf1530e8b27958a4e335cc2714e57e28e91ae7043c9730c46b87
|