#πŸ”’ how to get the bot to auto give coins when winning and lose coins when losing? pls help

32 messages Β· Page 1 of 1 (latest)

untold spoke
#

pls

wicked crestBOT
#

@untold spoke

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

untold spoke
#

pls

viscid sentinel
#

@untold spoke is this related to python?

untold spoke
#

Python

#

but

#

making a bot

#

so

viscid sentinel
#

Are you making a bot? We need more details

untold spoke
#

but

untold spoke
#

out of python language

viscid sentinel
#

Share your code and try to explain the issue again

untold spoke
#

okay

viscid sentinel
#

!paste

wicked crestBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

untold spoke
#

@bot.command(aliases=["slotpvp"])
async def slots_pvp(ctx, player2: discord.Member, bet: int):
if player2 == ctx.author:
return await ctx.send("❌ You can’t play against yourself!")
await ensure_user_exists(ctx.author.id)
await ensure_user_exists(player2.id)

if bet <= 0:
    return await ctx.send("❌ Invalid bet!")

bal1 = await get_balance(ctx.author.id)
bal2 = await get_balance(player2.id)
if bal1 < bet or bal2 < bet:
    return await ctx.send("❌ One of you doesn’t have enough CatCoins!")

emojis = ["πŸ’", "πŸ‹", "πŸ‡", "πŸ‰", "πŸ’Ž", "⭐"]

await ctx.send(f"🎰 **{ctx.author.display_name}** vs **{player2.display_name}** β€” spinning for {bet} CatCoins each...")
await asyncio.sleep(2)

def roll():
    result = [random.choice(emojis) for _ in range(3)]
    score = sum(emojis.index(e) + 1 for e in result)
    return result, score

r1, s1 = roll()
r2, s2 = roll()

msg = (
    f"🎰 {ctx.author.display_name}: {' | '.join(r1)} = {s1}\n"
    f"🎰 {player2.display_name}: {' | '.join(r2)} = {s2}\n\n"
)

if s1 > s2:
    await update_balance(ctx.author.id, bet)
    await update_balance(player2.id, -bet)
    msg += f"πŸ† **{ctx.author.display_name}** wins **{bet} CatCoins!**"
elif s2 > s1:
    await update_balance(ctx.author.id, -bet)
    await update_balance(player2.id, bet)
    msg += f"πŸ† **{player2.display_name}** wins **{bet} CatCoins!**"
else:
    msg += "😼 Tie! No CatCoins lost."

await ctx.send(msg)
wicked crestBOT
#

Hey @untold spoke!

Please edit your message to use a code block

```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
untold spoke
#
@bot.command(aliases=["slotpvp"])
async def slots_pvp(ctx, player2: discord.Member, bet: int):
    if player2 == ctx.author:
        return await ctx.send("❌ You can’t play against yourself!")
    await ensure_user_exists(ctx.author.id)
    await ensure_user_exists(player2.id)

    if bet <= 0:
        return await ctx.send("❌ Invalid bet!")

    bal1 = await get_balance(ctx.author.id)
    bal2 = await get_balance(player2.id)
    if bal1 < bet or bal2 < bet:
        return await ctx.send("❌ One of you doesn’t have enough CatCoins!")

    emojis = ["πŸ’", "πŸ‹", "πŸ‡", "πŸ‰", "πŸ’Ž", "⭐"]

    await ctx.send(f"🎰 **{ctx.author.display_name}** vs **{player2.display_name}** β€” spinning for {bet} CatCoins each...")
    await asyncio.sleep(2)

    def roll():
        result = [random.choice(emojis) for _ in range(3)]
        score = sum(emojis.index(e) + 1 for e in result)
        return result, score

    r1, s1 = roll()
    r2, s2 = roll()

    msg = (
        f"🎰 {ctx.author.display_name}: {' | '.join(r1)} = {s1}\n"
        f"🎰 {player2.display_name}: {' | '.join(r2)} = {s2}\n\n"
    )

    if s1 > s2:
        await update_balance(ctx.author.id, bet)
        await update_balance(player2.id, -bet)
        msg += f"πŸ† **{ctx.author.display_name}** wins **{bet} CatCoins!**"
    elif s2 > s1:
        await update_balance(ctx.author.id, -bet)
        await update_balance(player2.id, bet)
        msg += f"πŸ† **{player2.display_name}** wins **{bet} CatCoins!**"
    else:
        msg += "😼 Tie! No CatCoins lost."

    await ctx.send(msg)

#

like this

#

@viscid sentinel

#

idk how to add money when wiining

#

e

snow flume
#

Why should we invest time here and fix some code for you, that is 100% AI-generated, where you didn't invest any personal effort, and where everything code-wise is so far out of your understanding that even if we did invest multiple hours, you probably wouldn't take anything away from it?

#

We're not your "Fix broken ChatGPT code" utility.

untold spoke
#

thanks

#

!clΓ³e

#

!close

wicked crestBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.