A library with leveling cards for your discord bot.
Project description
DiscordLevelingCard
A library with Rank cards for your discord bot.
card preview
card1
installation
for pypi version
pip install discordlevelingcard
for github developement version
pip install git+https://github.com/ResetXD/DiscordLevelingCard
How To Use
If you don't provide path
then the method will return bytes
which can directly be used in discord.py/disnake/pycord/nextcord 's File class
.
Example
since no path was given, it returns bytes which can directly be used in discord.py and its fork 's File class.
from disnake.ext import commands
from DiscordLevelingCard import RankCard
import disnake
client = commands.Bot()
@client.slash_command(name="rank")
async def user_rank_card(ctx, user:disnake.Member):
await ctx.response.defer()
a = RankCard(
background=user.banner.url,
avatar=user.display_avatar.url,
level=1,
current_exp=1,
max_exp=1,
username="cool username"
)
image = await a.card1()
await ctx.edit_original_message(file=disnake.File(image, filename="rank.png")) # providing filename is very important
if you want to use path
@client.slash_command(name="rank")
async def user_rank_card(ctx, user:disnake.Member):
await ctx.response.defer()
a = RankCard(
background="https://cool-banner-url.com",
avatar=user.display_avatar.url,
level=1,
current_exp=1,
max_exp=1,
username="cool username",
bar_color="red",
text_color="white",
path="./user_cards/rank_card.png"
)
# image return the path provided i.e. "./user_cards/rank_card.png"
image = await a.card1()
await ctx.edit_original_message(file=disnake.File(image, filename="rank.png")) # providing filename is very important
Documentation
RankCard
class
__init__
method
RankCard(
background:Union[PathLike, BufferedIOBase],
avatar:Union[PathLike, BufferedIOBase],
level:int,
current_exp:int,
max_exp:int,
username:str,
bar_color:str="white",
text_color:str="white",
path:str=None
)
background
- background image url or file-object in rb
mode
avatar
- avatar image url or file-object in rb
mode
level
- level of the user
current_exp
- current exp of the user
max_exp
- max exp of the user
username
- username of the user
bar_color
- color of the bar [example: "white" or "#000000"]
text_color
- color of the text [example: "white" or "#000000"]
path
- path to save the card [if not provided will return bytes
instead]
card1
method
RankCard.card1()
returns
- path
if path
was provided in __init__
or bytes
if path
was not provided in __init__
todo
- add more cards
- better documentation
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
Hashes for discordlevelingcard-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 828211d0a21aa947afea7e8f5faf4e5225d4b423d71be6bcab050f9cbc4ff40d |
|
MD5 | 136746fb34c0705952f0324141acd649 |
|
BLAKE2b-256 | 8f85948f7ebe5ce1230389f4a3b7d36c5041a76be6e83e3fde79e58642b4f6cc |
Hashes for discordlevelingcard-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 205f54d7e9836997513d41a5bb076b8f5aaf96628a586ae870f53a0bd3f5cd44 |
|
MD5 | 4acab644de8ad1fbe30e4e8d5cfa49e6 |
|
BLAKE2b-256 | f38139d6b79b83342fe25da4c76cb64456d69d7ad9e71d1c2b8384a47196ef0b |