Skip to main content

Official async Python SDK for the Auralis music platform

Project description

auralis

Official async Python SDK for the Auralis music platform. One dependency (aiohttp), a tiny command surface, and the whole queue/skip/loop/shuffle brain handled for you.

pip install pyauralis

Quickstart

import asyncio
from auralis import Client, LoopMode

client = Client("http://localhost:8080", "YOUR-API-TOKEN")

@client.event
async def on_track_start(player, data):
    print("now playing:", player.current.title)

@client.event
async def on_queue_end(player):
    await player.disconnect()

async def main():
    await client.start()
    player = client.get_player(guild_id=123456789)

    # --- wire your Discord library's voice events to the player (see below) ---

    await player.play("ytsearch:never gonna give you up")
    await player.add("https://youtu.be/dQw4w9WgXcQ")
    player.set_loop(LoopMode.QUEUE)
    await asyncio.Event().wait()

asyncio.run(main())

Player commands

Command Does
await player.play(query) resolve + enqueue, start if idle
await player.add(query) enqueue only
await player.skip() advance to next track
await player.stop() stop + clear queue (stays connected)
await player.pause() / resume() pause / resume
await player.seek(ms) seek
await player.set_volume(0..1000) volume (100 = unity)
player.set_loop(LoopMode.OFF/TRACK/QUEUE) loop mode
player.shuffle() shuffle the queue
player.now_playing() current Track
await player.set_filters("bass=g=8") raw ffmpeg -af filtergraph
await player.disconnect() tear down the player

query is a search string ("ytsearch:…", a URL, a playlist URL) or a Track you already loaded via client.search(...) / client.load_tracks(...).

Events

@client.event on an async def on_<name>(...), or client.add_listener("<name>", cb):

Event Args
on_ready()
on_track_start(player, data) track began
on_track_end(player, data) track ended (data["reason"])
on_track_exception(player, data) playback error
on_track_stuck(player, data) stalled
on_player_update(player, data) live state (player.state)
on_voice_closed(player, data) Discord voice closed
on_queue_end(player) nothing left to play
on_disconnect() websocket dropped (auto-reconnects)

Wiring Discord voice

The SDK never touches the Discord gateway — your bot owns that. Join a channel with your library, then forward the two raw voice payloads:

# discord.py raw gateway events
@bot.event
async def on_socket_raw_receive(...):
    ...  # or use a gateway hook

# when you get VOICE_SERVER_UPDATE for a guild:
client.get_player(guild_id).update_voice_server({"token": ..., "endpoint": ...})

# when you get VOICE_STATE_UPDATE for the bot:
client.get_player(guild_id).update_voice_state(
    {"session_id": ..., "channel_id": ..., "user_id": bot_user_id}
)

Once both arrive, the player connects and starts anything already queued.

Notes

  • The queue lives in this process (lost on bot restart).
  • Node internals (node ids, endpoints, regions) are never exposed by this SDK.
  • pip install "pyauralis[speedups]" pulls in orjson for faster JSON.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyauralis-0.2.1.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyauralis-0.2.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file pyauralis-0.2.1.tar.gz.

File metadata

  • Download URL: pyauralis-0.2.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyauralis-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c0c8e127d6e7375a7f264d2f638c1f73741c844f45ed820c8971606b1301fe2c
MD5 0b2778e52fddd7033d246ca11ce1957e
BLAKE2b-256 a7d3c5680055f54d05f0d982fbd490a987706d2bc9dc594622b0fab64288f340

See more details on using hashes here.

File details

Details for the file pyauralis-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pyauralis-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyauralis-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b528c14646453462914b4cdf1b2a499ed272713715e807b7ab5ae4b0785ab801
MD5 c92fb2ccfab43c034b8d8171376ed126
BLAKE2b-256 f33fb529637a8e16d0c1a401ddcf0b054f03276540b5ee6e4741ea46121144ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page