Coder Social home page Coder Social logo

krishsharma0413 / discordlevelingcard Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 7.0 2.44 MB

A library with leveling cards for your discord bot.

License: MIT License

Python 100.00%
discord discord-bot discord-leveling discord-leveling-system discord-levelling-bot discord-py discordbot discordleveling discordpy disnake image-processing level nextcord pil pillow pycord rank rank-card rankcard ranking

discordlevelingcard's Introduction

💫About Me

I am a full-stack developer. I love coding in python and creating Open-Source projects! My hobbies apart from programming is photography.

🌐Socials

💻Tech Stack

📊GitHub Stats

github stats more github stats even more github stats

discordlevelingcard's People

Contributors

krishsharma0413 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

discordlevelingcard's Issues

doesnt work

im getting this error:
Ignoring exception in command rank:
Traceback (most recent call last):
File "/home/container/.venv/lib/python3.11/site-packages/discord/commands/core.py", line 124, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "/home/container/.venv/lib/python3.11/site-packages/discord/commands/core.py", line 982, in _invoke
await self.callback(ctx, **kwargs)
File "/home/container/main.py", line 323, in rank
await ctx.respond(embed=embed, file=disnake.File(image, filename="rank.png"))
File "/home/container/.venv/lib/python3.11/site-packages/discord/ext/bridge/context.py", line 93, in respond
return await self._respond(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.venv/lib/python3.11/site-packages/discord/ext/bridge/context.py", line 146, in _respond
return await self._get_super("respond")(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.venv/lib/python3.11/site-packages/discord/commands/context.py", line 282, in respond
return await self.interaction.response.send_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.venv/lib/python3.11/site-packages/discord/interactions.py", line 809, in send_message
raise InvalidArgument("file parameter must be File")
discord.errors.InvalidArgument: file parameter must be File
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/.venv/lib/python3.11/site-packages/discord/bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "/home/container/.venv/lib/python3.11/site-packages/discord/commands/core.py", line 375, in invoke
await injected(ctx)
File "/home/container/.venv/lib/python3.11/site-packages/discord/commands/core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: InvalidArgument: file parameter must be File
i tried io.bytes, tempfile and doesnt work. i think is because im using pycord idk

Crashing without error

Since I switched to a new host and installed the newest version through pip it crashes when using the following:
image = await card.card1() or image = await card.card2() or image = await card.card3()
The problem Im facing now is that I can not even debug the issue because it also crashes in debug mode without any error or warning.
After a week of trying and no results I hope someone here can help me.

Subtract xp from previous level

Would it be possible to add the option to subtract the xp from the previous level? It would make it possible to indicate the total xp at the top but only the progress of the current level would be shown at the xp bar.

Background Path not working

Hello, it's me again
I have a problem: the background= method does not work for me.
When I try to use the user's background:
My code:

if platform.system() == 'Windows': # if the system is windows
      backgroundPath='Y:\LikiyDiscord\Bot\background.png'
    else: # if the system is not windows (linux: docker)
      backgroundPath='/usr/src/bot/Background.png'
    a = RankCard(
        settings=card_settings,
        background=user.banner.url,
        avatar=user.display_avatar.url,
        level=1,
        current_exp=1,
        max_exp=1,
        username="cool username"
    )

It says:
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'url'

When I use a background in a file:
My code:

if platform.system() == 'Windows': # if the system is windows
      backgroundPath='Y:\LikiyDiscord\Bot\background.png'
    else: # if the system is not windows (linux: docker)
      backgroundPath='/usr/src/bot/Background.png'
    a = RankCard(
        settings=card_settings,
        background=backgroundPath,
        avatar=user.display_avatar.url,
        level=1,
        current_exp=1,
        max_exp=1,
        username="cool username"
    )

It says:
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: __init__() got an unexpected keyword argument 'background'

J'utilise la librairie py-cord, c'est un fork de discord.py
Do you have any idea why?

Have a nice day

P.s. create a buymeacoffee

Error with PIL

Hey, there is an error with your module using PIL

Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x0000025B06394190>:
Traceback (most recent call last):
  File "C:\Users\Zaidorox\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 824, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "C:\Users\Zaidorox\Desktop\Evolium bot\Evolium.py", line 545, in user_rank_card
    image = await a.card1()
  File "C:\Users\Zaidorox\AppData\Local\Programs\Python\Python310\lib\site-packages\DiscordLevelingCard\discord_card.py", line 142, in card1
    draw.text((205,(327/2)+20), self.username,font=myFont, fill=self.text_color,stroke_width=1,stroke_fill=(0, 0, 0))
  File "C:\Users\Zaidorox\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\ImageDraw.py", line 408, in text    if self._multiline_check(text):
  File "C:\Users\Zaidorox\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\ImageDraw.py", line 370, in _multiline_check
    return split_character in text
TypeError: argument of type 'Member' is not iterable

The above exception was the direct cause of the following exception:

nextcord.errors.ApplicationInvokeError: Command raised an exception: TypeError: argument of type 'Member' is not iterable

More customization options?

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.

Syntaxt issue

Hello,
First of all, thank you for all this! Your work looks great!
I have a problem though:
It seems you forgot a comma in README.md, after settings=card_settings,.
Have a nice day

Image keeps rendering weird

076632F1-6F2F-487A-A5DB-D58F99BEA337
This is what it rendered with these settings:

card_settings = Settings(background="https://i.imgur.com/gnJj059.png", text_color="black", bar_color="black", background_color="black")

I want the box that is black in the card 3 example to be black in mine but it keeps doing a red-ish purple.

@ResetXD

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.