krishsharma0413 / DiscordLevelingCard

A library with leveling cards for your discord bot.
MIT License
43 stars 7 forks source link

More customization options? #10

Open SpaceLuc opened 1 year ago

SpaceLuc commented 1 year ago

Hey, would it be possible to make the individual cards customizable in size and position of the individual elements? Currently you have to stick to the default design and can only change the color of the text/bar.

I like the style of the third card (it's similar to mee6's), but it's way too big and takes up too much space in the chat.

Would love it if there was an option that you can set the positions and sizes of the individual elements. Kind of like a sandbox where you push everything to the right place yourself.

krishsharma0413 commented 1 year ago

sounds interesting!

Though i need more info on this about what exactly you are looking for with examples.

SpaceLuc commented 1 year ago

In simple words: I want to have some variables to set the size and coordinates of each element. So I can make the user image a little smaller and move it to another place or just move the text a bit. Also the possibility to set the size of the background image and the "black frame" would be great.

krishsharma0413 commented 1 year ago

ahhh not bad of an idea! i will look into this immediately and most likely update the library within two day. please test and give your feedback when it is done.

PS. if you like the library then staring the repo really keeps me motivated. ❤

SpaceLuc commented 1 year ago

Thanks, I will give you feedback once you are done

PS. you have now another star 😉

krishsharma0413 commented 1 year ago

good evening SpaceLuc, I added something and I really want you to test it out because I don't have a discord bot to test on.

I added Sandbox class to create custom card1 if constantly changing code and running discord bot to see your custom card becomes tedious, I added Tester class. I also added another Example folder for how to use the tester class.

Current sandbox only has one method which helps with customizing card1 only.

you can also resize the result image withresizeattribute available incard1,card2,card3` and sandbox card1

examples.

white_card1

blue_card1

black_card1

example code should look something like:

from DiscordLevelingCard import Sandbox, Settings, Tester
import asyncio
from PIL import Image

setting = Settings(
    background="./bg.jpg",
    bar_color="white",
    text_color="white")

async def main():
    rank = Sandbox(
        username="resetxd",
        level=10,
        current_exp=100,
        max_exp=400,
        settings=setting,
        avatar=Image.open("./avatarimg.png")
    )
    await rank.custom_card1(card_colour="blue") # "blue" or "#0000FF" both should work
    Image.open(result).save("result.png", "PNG")

asyncio.run(main())

Do you like this feature? I loved it 🎉

SpaceLuc commented 1 year ago

Hey! Thanks for your efforts, the code works.

image

krishsharma0413 commented 1 year ago

Why is there a black line on the red card? It came at first on mine as well but then i recreated the asset to fix it. I think your system is cacheing the old asset instead of download the new one

SpaceLuc commented 1 year ago

idk ... but it seems that the image somehow shows through from below?

krishsharma0413 commented 1 year ago

What? I didn't understand

krishsharma0413 commented 1 year ago

If you fine with it, we should continue this on discord.

SpaceLuc commented 1 year ago

yeah, sure i send you a fa