A leveling cog for discord bots
Reason this release was yanked:
This version is outdated. Please install the latest version.
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dislevel-0.0.5.tar.gz.
File metadata
- Download URL: dislevel-0.0.5.tar.gz
- Upload date:
- Size: 138.4 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4238c02e3d56378a8af6e70d85c118717fa1cdc493cc657c0a28049238465e5c
|
|
| MD5 |
e2a2c984066c04cc87c64fac1d45a31b
|
|
| BLAKE2b-256 |
106c40385cb9ec2ab9315ac814f2721600148a7a60b0e5559983ed13d20fa831
|
File details
Details for the file dislevel-0.0.5-py3-none-any.whl.
File metadata
- Download URL: dislevel-0.0.5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad0a966613ae470e7f4b889bb5d7f0f88c42bfd5391798951f060629430c975a
|
|
| MD5 |
f0700c8f750a768ac49be1b0bc9bf386
|
|
| BLAKE2b-256 |
2abcbd813366f939a066ad0c8762f8a39201f83a1cfe7fe3b8b36af9763149ec
|