discord.pyembedtitle

Discord.py Question with weird betting winnings


enter image description here

As the title suggests, I have some trouble with the titles of my betting command. Sometimes it doesn't show up, while at other times it shows up as something with a lot of 1's and 0's. I think it might be binary, but I don't know. Code: https://replit.com/@jsun3/Betting-cmd#main.py

Stacks was being annoying on formatting so I did it in replit.

Ceres' answer helped, but caused another error. When I won sometimes it counted -10 won(meaning i lost 10). IMG:

enter image description here

New update for code: https://replit.com/@jsun3/Betting-cmd#main.py


Solution

  • The problem is that amount is a string, and in python you can multiply a string to repeat it. That is exactly what is happening. Solve it with

    @client.command(aliases=["gamble"])  # ASSUME I HAVE CLIENT DEFINED BC IN MY REAL CODE IT IS DEFINED.
    async def bet(ctx, amount: int = None):
    

    Since discord.py implements type-converters for arguments, your amount is converted to an integer, and will be multiplied like one.