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
import json
import os
from urllib.request import urlopen
from auralis import Client, LoopMode

def load_auralis_config():
    config_url = os.environ["BOT_CONFIG_URL"].rstrip("/") + "/internal/auralis-config"
    with urlopen(config_url) as res:
        return json.load(res)

config = load_auralis_config()
client = Client(config["apiBaseUrl"], config["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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pyauralis-0.4.1-cp314-none-any.whl (42.8 kB view details)

Uploaded CPython 3.14

pyauralis-0.4.1-cp313-none-any.whl (38.9 kB view details)

Uploaded CPython 3.13

pyauralis-0.4.1-cp312-none-any.whl (38.4 kB view details)

Uploaded CPython 3.12

pyauralis-0.4.1-cp311-none-any.whl (38.0 kB view details)

Uploaded CPython 3.11

pyauralis-0.4.1-cp310-none-any.whl (26.5 kB view details)

Uploaded CPython 3.10

File details

Details for the file pyauralis-0.4.1-cp314-none-any.whl.

File metadata

  • Download URL: pyauralis-0.4.1-cp314-none-any.whl
  • Upload date:
  • Size: 42.8 kB
  • Tags: CPython 3.14
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyauralis-0.4.1-cp314-none-any.whl
Algorithm Hash digest
SHA256 536feb52ed629895eb6938446e6daf86ff4764bfb0b8c592edff3f84ab4bb0d2
MD5 52ac807d434f56784c38642e5391a4db
BLAKE2b-256 e0576c4d9c332138f1e08d8e0e186541be775db0e18d569f823275dd963bb06f

See more details on using hashes here.

File details

Details for the file pyauralis-0.4.1-cp313-none-any.whl.

File metadata

  • Download URL: pyauralis-0.4.1-cp313-none-any.whl
  • Upload date:
  • Size: 38.9 kB
  • Tags: CPython 3.13
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyauralis-0.4.1-cp313-none-any.whl
Algorithm Hash digest
SHA256 236e8b5bae1b271798fc4c24d1d1263152e8c71ba5819ed394ca4237059de568
MD5 8df81f9bc2eadcd3ba9042ab85a955aa
BLAKE2b-256 1ca3a23bf66a177733c85de8f8267cbe2e6a6e73a662c348e62d65f5492cd4f9

See more details on using hashes here.

File details

Details for the file pyauralis-0.4.1-cp312-none-any.whl.

File metadata

  • Download URL: pyauralis-0.4.1-cp312-none-any.whl
  • Upload date:
  • Size: 38.4 kB
  • Tags: CPython 3.12
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyauralis-0.4.1-cp312-none-any.whl
Algorithm Hash digest
SHA256 bc4d51ecfe53810d5f49f7d723be4160c50aa00aba23c07460cf883687e6490f
MD5 a6ea04c442ee503dd0d3cc2534f8a0d6
BLAKE2b-256 c47b640b17bec72dec1c8a28f6262929aa14b1ce30d87ad66c88053594504dcf

See more details on using hashes here.

File details

Details for the file pyauralis-0.4.1-cp311-none-any.whl.

File metadata

  • Download URL: pyauralis-0.4.1-cp311-none-any.whl
  • Upload date:
  • Size: 38.0 kB
  • Tags: CPython 3.11
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyauralis-0.4.1-cp311-none-any.whl
Algorithm Hash digest
SHA256 2ef53ad80f5fdf8bc7d04b9a3f3301cdaf4342062c6b03824e688e6ec9259c07
MD5 a54643ceb165c4b6bb3e1cec629bc23b
BLAKE2b-256 2a5bd1eb2349ef414b09100f957392eafb2f4a002c061d521ed669f67ef909f6

See more details on using hashes here.

File details

Details for the file pyauralis-0.4.1-cp310-none-any.whl.

File metadata

  • Download URL: pyauralis-0.4.1-cp310-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: CPython 3.10
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyauralis-0.4.1-cp310-none-any.whl
Algorithm Hash digest
SHA256 3b0513148757c48457056c5da3e0e167c8be18b655be16adfaadaa05b16eb635
MD5 4ce2446e291734e8990e0fabe6ccd35e
BLAKE2b-256 7744eddaad2bea053c33adc19991724ec771151262af4093c2be4589d1a66235

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