Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing without error #15

Closed
Melmacker opened this issue Apr 8, 2024 · 7 comments
Closed

Crashing without error #15

Melmacker opened this issue Apr 8, 2024 · 7 comments
Assignees

Comments

@Melmacker
Copy link

Melmacker commented Apr 8, 2024

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.

@krishsharma411
Copy link

I tried using the library myself and it seems to work for me. can you give me some reproducible code. where exactly are you using the library?

@Melmacker
Copy link
Author

Sry for my late reply I refreshed my browser every day but it didnt show your comment.
Below you can see the image Im using:
background

import discord
from discord.ext import commands
from DiscordLevelingCard import RankCard, Settings


bot = commands.Bot(command_prefix="/", intents=discord.Intents.all())

@bot.event
async def on_ready():
    await bot.tree.sync()

@bot.tree.command(name="level", description="Shows you your level")
async def level(interaction:discord.Interaction):
    await interaction.response.defer(thinking=True)
    level = 1
    xp = 0
    maxxp = 100
    card_tpye = 1
    card_settings = Settings(
        background="C:/Users/Administrator/Documents/background.png",
        text_color="#FFFFFF",
        bar_color="#FFFFFF",
        background_color="#36393F"
    )

    card = RankCard(
        settings=card_settings,
        avatar=interaction.user.display_avatar.url,
        level=level,
        current_exp=xp,
        max_exp=maxxp,
        username=interaction.user.display_name
    )
    if card_tpye == 1:
        image = await card.card1()
    elif card_tpye == 2:
        image = await card.card2()
    elif card_tpye == 3:
        image = await card.card3()
    await interaction.followup.send(file=discord.File(image, filename="rank.png"))


bot.run("TOKEN")

@krishsharma0413
Copy link
Owner

since you said that you are using a host then it somewhat makes sense that the line background="C:/Users/Administrator/Documents/background.png", won't actually work. try giving it a relative path than the absolute path and save the background image in your project folder.

If the error still persists then please do let me know

@Melmacker
Copy link
Author

It still crashes. I also have other resources that I use in the documents folder, which all can be found.

@krishsharma0413
Copy link
Owner

try running the code on your local laptop/PC and check if the error still exists. I still don't truly understand the error since the library works properly for me. It could be a version mismatch as well (library is created for 3.9x and not for anything >3.10). There isn't an error message which is weird as well.

@krishsharma0413 krishsharma0413 self-assigned this Apr 20, 2024
@Melmacker
Copy link
Author

Thank you. It was a version mismatch, I used 3.12 on the new host machine and it works now after I switched back to 3.9.
Could you please add a quick version check with an error message to it?

Keep up the amazing work :D

@krishsharma0413
Copy link
Owner

I will definitely add the version check. If you have any other feature you want me to add or implement please do tell.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants