A library with leveling cards for your discord bot.
Project description
DiscordLevelingCard
A library with Rank cards for your discord bot.
card preview
card1
card2
card3
same as card2 but with background
installation
for pypi version
pip install discordlevelingcard
for github developement version
pip install git+https://github.com/krishsharma0413/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 provided, 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, Settings
import disnake
client = commands.Bot()
# define background, bar_color, text_color at one place
card_settings = Settings(
background="url or path to background image",
text_color="white",
bar_color="#000000"
)
@client.slash_command(name="rank")
async def user_rank_card(ctx, user:disnake.Member):
await ctx.response.defer()
a = RankCard(
settings=card_settings,
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
Documentation
RankCard class
__init__
method
RankCard(
settings: Settings,
avatar:str,
level:int,
current_exp:int,
max_exp:int,
username:str,
rank: Optional[int] = None
)
-
settings
- Settings class from DiscordLevelingCard. -
avatar
- avatar image url. -
level
- level of the user. -
current_exp
- current exp of the user. -
max_exp
- max exp of the user. -
username
- username of the user. -
rank
- rank of the user. (optional)
Settings class
__init__
method
Settings(
background: Union[PathLike, BufferedIOBase, str],
bar_color: Optional[str] = 'white',
text_color: Optional[str] = 'white',
background_color: Optional[str]= "#36393f"
)
-
background
- background image url or file-object inrb
mode.4:1
aspect ratio recommended.
-
bar_color
- color of the bar [example: "white" or "#000000"] -
text_color
- color of the text [example: "white" or "#000000"] -
background_color
- color of the background [example: "white" or "#000000"]
card1 method
RankCard.card1()
returns
- bytes
which can directly be used within discord.File
class.
card2 method
RankCard.card2()
returns
- bytes
which can directly be used within discord.File
class.
card3 method
RankCard.card3()
returns
- bytes
which can directly be used within discord.File
class.
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.4.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a7bf3f18ce069c630dbb4c7bfde44e8342f62ac33180dddaa3e81c2acc861b3 |
|
MD5 | 431083dd4af06bf65d8aec4dc0269ba0 |
|
BLAKE2b-256 | 4f2c58c0a520f271212e7a12b01dcce73cc1b0d2626150d2e1ec152506189ca1 |
Hashes for discordlevelingcard-0.4.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a05df2a3bd074e4597eebfaf70c9dc4cf9067a31b61129123a3ad25a9601a968 |
|
MD5 | 0140e23e4106e869a31506282e1c21b3 |
|
BLAKE2b-256 | df918d5d0cba8b1c582868d3210b5b3d90e9e9b87d114c11a63df1c9e38e9902 |