Skip to main content

lolka.py

Fork of discord.py (MIT License, © 2015-present Rapptz).

lolka.py (imported as import lolka) is a Python wrapper for the lolka bot API. It targets lolka by default — no manual REST/Gateway overrides needed — decodes lolka snowflakes, and resolves lolka CDN asset URLs. See LICENSE for licensing (the original MIT copyright is retained).

Installing

Python 3.8 or higher is required

# Linux/macOS
python3 -m pip install -U lolka.py

# Windows
py -3 -m pip install -U lolka.py

Quick Example

import lolka

class MyClient(lolka.Client):
    async def on_ready(self):
        print('Logged on as', self.user)

    async def on_message(self, message):
        if message.author == self.user:
            return

        if message.content == 'ping':
            await message.channel.send('pong')

intents = lolka.Intents.default()
intents.message_content = True
client = MyClient(intents=intents)
client.run('token')

Bot Example

import lolka
from lolka.ext import commands

intents = lolka.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='>', intents=intents)

@bot.command()
async def ping(ctx):
    await ctx.send('pong')

bot.run('token')

Configuration

The defaults point at production lolka. For dev or staging, override them with environment variables:

  • LOLKA_API_BASE — bot API base (default https://lolka.app/api/bot)

  • LOLKA_GATEWAY — gateway URL (default wss://lolka.app/ws/bot)

  • LOLKA_CDN — CDN for assets (default https://cdn.lolka.app)

  • LOLKA_WEB — web client, used for jump_url, oauth_url and similar links (default https://lolka.app)

  • LOLKA_INVITE — invite links host (default https://lolka.gg)

The lolka CDN does not resize or convert images (webp only), so with_size, with_format and replace on assets validate their arguments but never change the URL.

Voice

Voice works over WebRTC (lolka’s voice stack), not Discord’s UDP transport. The required dependencies ship with the base install — nothing extra to add. Opus sources (FFmpegOpusAudio) need the system libopus (apt install libopus0; bundled on Windows); PCM sources (FFmpegPCMAudio) don’t.

The API stays discord.py-compatible — await channel.connect() returns a VoiceClient that speaks lolka’s WebRTC voice under the hood:

vc = await channel.connect()
vc.play(lolka.FFmpegPCMAudio('song.mp3'))

# receive/record other participants' audio (optional):
def on_track(track, user_id, producer_id):
    ...  # track is an aiortc MediaStreamTrack
vc.on_receive_track = on_track

...
await vc.disconnect()

The track passed to on_receive_track only delivers frames from the moment it was handed over and keeps just the latest one, so read it (await track.recv() in a loop until MediaStreamError) or call track.stop() if you do not need it. Only audio producers are consumed (video is ignored).

after callbacks of vc.play() run in a helper thread, after source.cleanup(), so they may block or call vc.play() again; use asyncio.run_coroutine_threadsafe(coro, vc.loop) to run a coroutine from them. after may arrive up to 2 seconds late if the source’s read() hangs.

If the voice connection is lost (the voice server restarted, the network dropped), the client disconnects and leaves the channel; reconnect=True is accepted for compatibility but reconnecting is up to the bot.

Migrating from discord.py

Already have a discord.py bot? You don’t have to rewrite it — just alias the import:

import lolka as discord
from lolka.ext import commands

# everything below is unmodified discord.py bot code
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='>', intents=intents)

@bot.command()
async def ping(ctx):
    await ctx.send('pong')

bot.run('token')

import lolka as discord covers every discord.Whatever attribute access in your existing code (discord.Client, discord.Intents, discord.Embed, checks, errors, and so on). The only lines that actually need editing are explicit submodule imports, since Python resolves those by real module path rather than by the alias:

  • import discord → import lolka as discord

  • from discord import X → from lolka import X

  • from discord.ext import commands → from lolka.ext import commands

  • from discord import app_commands → from lolka import app_commands

That’s it — the rest of your bot’s code stays exactly as it is.

Metadata

Release files for lolka.py 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lolka.py 0.6.1
File Size Uploaded Provenance Actions
lolka_py-0.6.1.tar.gz 1.1 MB With provenance Details for lolka_py-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lolka.py 0.6.1
File Interpreter ABI Platform Actions
lolka_py-0.6.1-py3-none-any.whl Python 3 none any Details for lolka_py-0.6.1-py3-none-any.whl

Total release size: 2.4 MB

Release files / lolka_py-0.6.1.tar.gz

Download URL lolka_py-0.6.1.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
028d79adb73d5f0cf029f50e80770b5dfacc348f3ca5faedb8e61ba2567dc45b
BLAKE2b-256 checksum
How to use checksums
a543a9b3e2e55b5fc5e4c9a48856f887cd6cc80af26e6cafcd5a81fc0bf1747b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / lolka_py-0.6.1-py3-none-any.whl

Download URL lolka_py-0.6.1-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
886034e829ac1cd26f7d7f32c62000ff99bc24b8d209dd456c687b1d49fd53f5
BLAKE2b-256 checksum
How to use checksums
49bb935191a486fc909b90df62340230a3aa550df109e9be4d24c023c1f1b6fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for lolka.py 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lolka_py-0.6.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page