Cjenkin31 / banana-discord-bot

Discord Utility And Game Bot
MIT License
1 stars 1 forks source link

Add Gambling #4

Open Cjenkin31 opened 7 months ago

jakewac commented 7 months ago

sir yes sir

Cjenkin31 commented 7 months ago

I added some commands to help: in data.currency You can call get_bananas(userid) to get the amount of bananas a user has then add_bananas and remove_bananas with the userid and amount

We can prob move half the coinflip command to a new file called utils.currency_helper.py

And have that do checks against the user i.e

        # Determine if the bet is 'all' or a specific amount
        if bet_amount.lower() == 'all':
            current_bananas = await get_bananas(str(interaction.user.id))
            bet_amount = current_bananas
        else:
            try:
                bet_amount = int(bet_amount)
                if bet_amount <= 0:
                    raise ValueError("Bet amount must be a positive number.")
            except ValueError as e:
                await interaction.response.send_message(str(e))
                return

        user_id = str(interaction.user.id)
        current_bananas = await get_bananas(user_id)

        if current_bananas == 0:
            await interaction.response.send_message("You have no {BANANA_COIN_EMOJI}!")
            return

        if bet_amount > current_bananas:
            await interaction.response.send_message("You don't have enough {BANANA_COIN_EMOJI} to make this bet.")
            return

That stuff