Skip to main content

A Python wrapper for the lolka bot API (discord.py-compatible fork)

Project description

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')

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.

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()

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 discordimport lolka as discord

  • from discord import Xfrom lolka import X

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

  • from discord import app_commandsfrom lolka import app_commands

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

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

lolka_py-0.4.0.tar.gz (628.8 kB view details)

Uploaded Source

Built Distribution

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

lolka_py-0.4.0-py3-none-any.whl (754.1 kB view details)

Uploaded Python 3

File details

Details for the file lolka_py-0.4.0.tar.gz.

File metadata

  • Download URL: lolka_py-0.4.0.tar.gz
  • Upload date:
  • Size: 628.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lolka_py-0.4.0.tar.gz
Algorithm Hash digest
SHA256 684a1c66af8090a20ccf1b6e92b9f4cbf93247cfe82270b18eda66a715221bdd
MD5 95fc8e26d29e5bcc45145a0924a4c4fc
BLAKE2b-256 dbf0768edf7b6bbbbdcfc53a17ca9c7a6b38dc58d1e64e988aa57a5eaa415c88

See more details on using hashes here.

Provenance

The following attestation bundles were made for lolka_py-0.4.0.tar.gz:

Publisher: release.yml on Lolka-App/lolka.py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lolka_py-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: lolka_py-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 754.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lolka_py-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d248ad4aba3a3bd9ae01dd973b674ea22b711bf793520f199285eab91ac5084b
MD5 0832fd981d1e89b14b298e3cdc1c95f8
BLAKE2b-256 74bc78b51ba4118a887e768c74763471f001ad12ba2882f5e9dd3f11da8fb166

See more details on using hashes here.

Provenance

The following attestation bundles were made for lolka_py-0.4.0-py3-none-any.whl:

Publisher: release.yml on Lolka-App/lolka.py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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