Skip to main content

A library rich with many image generation funcitons powered by PIL for your discord bot such as leveling, welcome card and meme generation!

Project description

pilcord

github

status: new image gen everyday!

A library rich with many image generation funcitons powered by PIL for your discord bot such as leveling, welcome card and meme generation!

ranking card preview

card1

card1

card2 card

card3 same as card2 but with background card


meme generation preview

fight_under_this_flag

fight_under_this_flag

uwu_discord

image preview

installation

for pypi version

pip install pilcord

for github developement version

pip install git+https://github.com/ResetXD/pilcord

How To Use

The method will return bytes which can directly be used in discord.py/disnake/pycord/nextcord 's File class.


Documentation

rank card docs

RankCard class

__init__ method

RankCard(
    settings: CardSettings,
    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)

CardSettings class

__init__ method

CardSettings(
    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 in rb 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.

card1


card2 method
RankCard.card2()

returns - bytes which can directly be used within discord.File class.

card


card3 method
RankCard.card3()

returns - bytes which can directly be used within discord.File class.

card


example

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, CardSettings
import disnake

client = commands.Bot()
# define background, bar_color, text_color at one place
card_settings = CardSettings(
    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",
        rank=1
    )
    image = await a.card1()
    await ctx.edit_original_message(file=disnake.File(image, filename="rank.png")) # providing filename is very important

rank card docs

Meme class

__init__ method

Meme(
    avatar: str
)
  • avatar - image url.
fight_under_this_flag method
Meme.fight_under_this_flag()

returns - bytes which can directly be used within discord.File class.

fight_under_this_flag


uwu_discord method
Meme.uwu_discord()

returns - bytes which can directly be used within discord.File class.

uwu_discord

example

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 Meme
import disnake

client = commands.Bot()

@client.slash_command(name="fight_under_this_flag")
async def fight_under_this_flag_meme(ctx, user:disnake.Member):
    await ctx.response.defer()
    a = Meme(
        avatar=user.display_avatar.url
    )
    image = await a.fight_under_this_flag()
    await ctx.edit_original_message(file=disnake.File(image, filename="fight.png")) # providing filename is very important

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

pilcord-1.0.0.tar.gz (251.1 kB view details)

Uploaded Source

Built Distribution

pilcord-1.0.0-py3-none-any.whl (251.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pilcord-1.0.0.tar.gz
  • Upload date:
  • Size: 251.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.4 Windows/10

File hashes

Hashes for pilcord-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2b540483b0dcbcc127000c48ca56f96c872190883067f2b972749041e334112d
MD5 d741fd98652a76f2e3946d968f687c55
BLAKE2b-256 0ab3e1d5f94f4a66a2fc720628727292fcad2a6b22eed1c3e75fcd49e3de04fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pilcord-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 251.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.4 Windows/10

File hashes

Hashes for pilcord-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1aecf5d2302eac59878a9dc8e1aaaf0122443a985577c34c14653bc36599f1ee
MD5 0be2fc1db5945f074b13556bbd3539c6
BLAKE2b-256 8c75c5a4dcb2765d091e4db29a4db7ba1ec53d20662da8413ecf0da43f428535

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page