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 -m
or similar if that is how you install packages. Generally windows usespy -m pip
and 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
mafic-2.10.0.tar.gz
(42.1 kB
view details)
Built Distribution
mafic-2.10.0-py3-none-any.whl
(49.6 kB
view details)
File details
Details for the file mafic-2.10.0.tar.gz
.
File metadata
- Download URL: mafic-2.10.0.tar.gz
- Upload date:
- Size: 42.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dddec9e97808d231379583188286232d408face8b7b4eb3f16bf3c1d8ae8b5b0 |
|
MD5 | 0e66e79003a1562f7d70d91a655fb785 |
|
BLAKE2b-256 | 44575c5e35b10896385f198011e15e6c3bc4d3579071ce62f8e541f6e70de713 |
File details
Details for the file mafic-2.10.0-py3-none-any.whl
.
File metadata
- Download URL: mafic-2.10.0-py3-none-any.whl
- Upload date:
- Size: 49.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 001214abaa92ebcaef321b297bd5b3386ae4ac29fc0f798770c403318062fcf8 |
|
MD5 | 6f207be49bd19c0ea9965a1cdeb90830 |
|
BLAKE2b-256 | 3e90e4a1ea7d8a8d1e2b436d1b85045fa5f012f6bcbf6f624af4808b0e67de1d |