Skip to main content

A leveling cog for discord bots

Project description

Dislevel

Making leveling easier for small as well as big bot

Installation

pip install dislevel

Usage

Making a simple bot with a db connection

from discord.ext import commands
from dislevel import increase_xp

bot = commands.Bot(command_prefix='/')


@bot.event
async def on_ready():
    print('We have logged in as {0.user}'.format(bot))


@bot.event
async def on_message(message):
    if not message.author.bot:
        await bot.process_commands(message)
        await increase_xp(message, bot, rate=5)

bot.load_extension('dislevel')

TOKEN = 'TOKEN_HERE'
bot.run(TOKEN)

For subclassed bot

from discord.ext import commands
from dislevel import increase_xp


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

    async def on_ready(self):
        print('We have logged in as {0.user}'.format(self.user))

    async def on_message(self, message):
        if not message.author.bot:
            self.process_commands(message)
            await increase_xp(message, bot, rate=5)
    

bot = MyCustomBot(command_prefix='/')

bot.load_extension('dislevel')

TOKEN = 'TOKEN_HERE'
bot.run(TOKEN)

And setup is done it will automatically configure database and store data in your database

By default it increases exp by 5 whenever increase_xp gets called but if you want a different rate then
await increase_xp(message, bot, rate=10)
Now exp will increase by 10

Run the bot and run the /rank command to see your rank

Commands

/rank - See your rank /leaderboard, /lb - See leaderboard /setbg <url> - Set your bg url /resetbg - Reset your bg url to default /levelrole - Check level roles /levelrole add <level> <role> - Add a level role /levelrole remove <level> - Remove a level role

Join Discord For any kind of help

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

dislevel-1.0.0.tar.gz (138.3 kB view details)

Uploaded Source

Built Distribution

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

dislevel-1.0.0-py3-none-any.whl (136.3 kB view details)

Uploaded Python 3

File details

Details for the file dislevel-1.0.0.tar.gz.

File metadata

  • Download URL: dislevel-1.0.0.tar.gz
  • Upload date:
  • Size: 138.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.26.0 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.1

File hashes

Hashes for dislevel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d80911459a8fc128c889ff062329543e8d94fb6866dfe6dc1cbd57d7eccc07fa
MD5 a54253d438c9c75191280d61b9682374
BLAKE2b-256 ba3a5f9c8085b721ff8d2c6932ff6c33d1173bb1ae7477f0efa011ce8eac7c9b

See more details on using hashes here.

File details

Details for the file dislevel-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dislevel-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 136.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.26.0 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.1

File hashes

Hashes for dislevel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62fe9f28fcc541aff59b7b8bbbfa9ef7ccd08cbf2e1e971889e8b11a2d35d851
MD5 13d50313319800c0c7eae5a9a8cf3303
BLAKE2b-256 b630fa79d042d7c2a24630b514a5543424ae67ad33ca3fab8f4a695d6b319fa6

See more details on using hashes here.

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