Skip to main content

Discord Levelling

A package built for discord.py developers who want to easily and seamlessly integrate a levelling system into their bots.

Key features

  • Easy database integration for any database system
  • Fully tested
  • Highly customizable
  • Plug & Play

Example usage

import os

import discord
from discord.ext import commands
from levelling import Level, LevelUpPayload


class Bot(commands.Bot):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.level = Level(self)

    async def on_ready(self):
        print(f"-----\nLogged in as: {self.user.name} : {self.user.id}\n-----")

    async def on_message(self, message):
        leveled_up = await self.level.propagate(message)
        if leveled_up:
            await self.on_level_up(leveled_up)

        await self.process_commands(message)

    async def on_level_up(self, payload: LevelUpPayload):
        # This is triggered when a LevellingMember levels up
        member = payload.guild.get_member(payload.member.id)
        embed = discord.Embed(
            title=f"`{member.display_name}` has leveled up to level `{payload.level}`!"
        )
        await payload.channel.send(embed=embed)


bot = Bot(command_prefix="!", intents=discord.Intents.all())


@bot.command()
async def leaderboard(ctx):
    leaderboard_members = await bot.level.leaderboard()
    desc = "\n".join(f"<@{m.id}> - level `{m.level}`" for m in leaderboard_members)

    await ctx.send(f"Here's our leaders!\n---\n\n{desc}")


if __name__ == "__main__":
    token = os.getenv("TOKEN")
    bot.run(token)

Documentation | Examples | Support

For documentation and examples, see here

Join the MenuDocs' discord server for support with this package!

or dm us on twitter!

Metadata

Release files for levelling 0.1.4

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

Source distribution (sdist)

Source distribution for levelling 0.1.4
File Size Uploaded Provenance Actions
levelling-0.1.4.tar.gz 9.6 kB Without provenance Details for levelling-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for levelling 0.1.4
File Interpreter ABI Platform Actions
levelling-0.1.4-py3-none-any.whl Python 3 none any Details for levelling-0.1.4-py3-none-any.whl

Total release size: 22.3 kB

Release files / levelling-0.1.4.tar.gz

Download URL levelling-0.1.4.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2f2ba6e5e84ea881d023288826e3cbf85e47f598c0937655d0bec3fc3dc29bff
BLAKE2b-256 checksum
How to use checksums
da9c1f3b470bcd0d907f9011cfa205d6375c2cbdea5396ee1e025583fdba0d34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5

Release files / levelling-0.1.4-py3-none-any.whl

Download URL levelling-0.1.4-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
863ca2a19016a84dcf6d2ac17582941abdf18e281215d96fdaa4a2ef27628738
BLAKE2b-256 checksum
How to use checksums
15a3135c5372a58060be031dd2b38243b6927c3be769976ef95eb3a233bf8634
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5

Security for levelling 0.1.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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