Skip to main content

Dislevel

Making leveling easier for small as well as big bot

Installation

pip install dislevel

Check Examples Here

Usage

Making a simple bot with a db connection. First of all we need a database connection. Dislevel supports 2 type of database connection.

  • asyncpg (Pool)
  • databases (Database)

If your bot already have a connection you can use that, Or you can create a new one for leveling. In this example I will create a new connection using databases[sqlite]

from databases import Database
from discord import Intents
from discord.ext import commands

from dislevel import init_dislevel
from dislevel.utils import update_xp

intents = Intents.default()
# Nextcord current version uses discord Api v9 where message content intent is not enforced. 

# If you ware are using discord.py when you will need to enable message_content intent manually explicitly as shown below
# intents.message_content = True

bot = commands.Bot(command_prefix="?", intents=intents)


@bot.event
async def on_ready():
    # Using databases to create a sqlite db
    db = Database("sqlite:///leveling.db")
    await db.connect()

    # Pass instance of bot, the database connection and specify which driver to use. In this case we are using databases so we passed that
    await init_dislevel(bot, db, "databases")
    print("Ready! Let's go...")


@bot.event
async def on_message(message):
    if message.author.bot:
        return

    # You can use this method anywhere to update xp of a member
    # First pass the bot instance, member_id, guild_id and how much xp to be added.
    await update_xp(bot, message.author.id, message.guild.id, amount=10)

    await bot.process_commands(message)

# Load the cog. It has 4 cogs. `dislevel.nextcord`, `dislevel.nextcord.slash`, `dislevel.discord`, `dislevel.discord.slash`
# If you want to use nextcord.slash you should load it ouside on_ready. Otherwise you can load it inside on_ready
# You can also load both slash and normal cog.
bot.load_extension("dislevel.nextcord")

TOKEN: str = "Your bot token here"
bot.run(TOKEN)

Events

# If you want to do something when a user level's up!
async def on_dislevel_levelup(guild_id, member_id, level):
    pass

Cogs

  • dislevel.discord - For discord.py 2.0

  • dislevel.discord.slash - For discord.py 2.0 (Slash Commands)

  • dislevel.nextcord - For nextcord 2.0

  • dislevel.nextcord.slash - For nextcord 2.0 (Slash Commands)

Commands

rank [member] - See your/member's rank
leaderboard, lb - See leaderboard
setbg <url> - Set your bg url
resetbg - Reset your bg url to default

Join Discord For any kind of help

Metadata

Release files for dislevel 2.0.3

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

Source distribution (sdist)

Source distribution for dislevel 2.0.3
File Size Uploaded Provenance Actions
dislevel-2.0.3.tar.gz 140.1 kB Without provenance Details for dislevel-2.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 280.8 kB

Release files / dislevel-2.0.3.tar.gz

Download URL dislevel-2.0.3.tar.gz
Size 140.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a288854e3cc3c06afe378797afbf7bddfc826aaa8544c0c1da0b5408a30bcd75
BLAKE2b-256 checksum
How to use checksums
8f7b85c7b61028b5f0c6dea13317b421089b6961653c978bb2777949a7e3d728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release files / dislevel-2.0.3-py3-none-any.whl

Download URL dislevel-2.0.3-py3-none-any.whl
Size 140.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee935107d087a749510e967e124400516197e0b7ab66856ab1beadd3f766cde2
BLAKE2b-256 checksum
How to use checksums
87fc30fe7231b215e55e1ff71efd8665fb6b9571da2102b31305eaa4a68bccb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Security for dislevel 2.0.3

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.

Release history Release notifications | RSS feed

This release

2.0.3 This release

2 release files No provenance

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