An easy to use package for levelling features in discord.py.
Project description
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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
levelling-0.1.4.tar.gz
(9.6 kB
view details)
Built Distribution
levelling-0.1.4-py3-none-any.whl
(12.7 kB
view details)
File details
Details for the file levelling-0.1.4.tar.gz
.
File metadata
- Download URL: levelling-0.1.4.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f2ba6e5e84ea881d023288826e3cbf85e47f598c0937655d0bec3fc3dc29bff |
|
MD5 | 7713cf2109c6ad5fcfdad85db8cc3ea0 |
|
BLAKE2b-256 | da9c1f3b470bcd0d907f9011cfa205d6375c2cbdea5396ee1e025583fdba0d34 |
File details
Details for the file levelling-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: levelling-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 863ca2a19016a84dcf6d2ac17582941abdf18e281215d96fdaa4a2ef27628738 |
|
MD5 | 636832b8304b5cc9b811856ae4860e2a |
|
BLAKE2b-256 | 15a3135c5372a58060be031dd2b38243b6927c3be769976ef95eb3a233bf8634 |