Пример #1
0
async def _aob(ctx, amount: int):
    user = ctx.author  # oh shoot i didn't realise you didnt have to put .message.
    num = random.randint(0, 100)
    await ctx.send('0-100 inclusive. 10 goes. hurry up nad go')
    for att in range(10):
        await ctx.send(f'You have **`{10-att}`** goes left')
        attempt = await client.wait_for("message",
                                        check=lambda m: m.author == user)
        if attempt.author == user:
            if att == 9:
                break
            if attempt.content == str(num):
                value = amount * 2
                await ctx.send(
                    f"GG, you got it. As a reward you get **`{value}`**.")
                conn, c = connection()
                get_value(conn, c, str(user), value)
                conn.close()
                return
            elif int(attempt.content) > num:
                await ctx.send('guess lower')
            else:
                await ctx.send('guess higher')
    await ctx.send('u lost lol')
    conn, c = connection()
    get_value(conn, c, user, (amount * -1))
Пример #2
0
async def coin(ctx, guess="0", amount=0):
    user = str(ctx.message.author)
    conn, c = connection()
    result = random.choice(ops)
    value = amount * 2
    loss = amount * -1
    if guess == "0":
        await ctx.send(
            "Please put either **heads** or **tails** after the command!")
    elif amount == 0:
        await ctx.send(
            "Please specify an **amount of money** you would like to bet")
    elif result == guess.lower():
        get_value(conn, c, user, value)
        await ctx.send(f'**You Got it Right!**')
        time.sleep(0.1)
        await ctx.send(f'**{value}** was added to your account')
    elif result != guess.lower():
        await ctx.send(f"You lost **{amount}**")
        get_value(conn, c, user, loss)
    else:
        await ctx.send(
            "I don't honestly know how this has happened but you broke it"
        )  #I love putting error messages just incase
    conn.close()
Пример #3
0
async def _yearly(ctx):
    user = str(ctx.message.author)
    conn, c = connection()
    if (user in yearly) and yearly[user] > time.time():
        waittime = yearly[user] - time.time()
        await ctx.send(
            f'Please wait **{math.floor(waittime/3600)}h {math.floor((waittime/60) % 60)}m** to use this again!'
        )
    else:
        await ctx.send('You got **50000!**')
        get_value(conn, c, user, 50000)
        conn.close()
        yearly[user] = time.time() + 31536000

    save_yearly()
Пример #4
0
async def buy(ctx,
              item1="0",
              item2="0",
              item3="0",
              item4="0",
              item5="0",
              item6="0"):
    user = str(ctx.message.author)
    item = make_a_word(item1, item2, item3, item4, item5, item6)
    if item == "0":
        await ctx.send("Please specify an item!")
    else:
        if item in shop:
            conn, c = connection()
            value = shop[item]
            get_value(conn, c, user, value)
            get_inv(conn, c, user,
                    item)  #<-- this is the thing that i need to do first
            await ctx.send(
                "Test Message **(means succesful purchase when completed)**")
            #need to remove the amount and give it to User
        elif item not in shop:
            await ctx.send(
                "**Please specify an item that you can actually buy!**")
Пример #5
0
async def _numbergame(ctx, guess=100, amount=0):
    user = str(ctx.message.author)
    result = random.randint(0, 99)
    value = amount * 4
    conn, c = connection()
    loss = amount * -1
    if guess == 100:
        await ctx.send("Please put your **guess** after the command")
    elif amount == 0:
        await ctx.send(
            "Please specify an **amount of money** you would like to bet")
    elif result == guess:
        get_value(conn, c, user, value)
        await ctx.send(f'**You Got it Right!**')
        time.sleep(0.1)
        await ctx.send(f'**{value}** was added to your account')
    elif result != guess:
        await ctx.send(f'The number was {result}')
        time.sleep(0.1)
        await ctx.send(f"You lost **{amount}**")
        get_value(conn, c, user, loss)
    else:
        await ctx.send(
            "I don't honestly know how this has happened but you broke it")
Пример #6
0
async def _blackjack(ctx, amount=0):
    user = ctx.author
    handvalue = 0
    otherhandvalue = 0
    temp = random.randint(1, 13)
    otherhand1 = temp
    temp = random.randint(1, 13)
    otherhand2 = temp
    temp = random.randint(1, 13)
    hand1 = temp
    temp = random.randint(1, 13)
    hand2 = temp
    if amount != 0:
        if hand1 == 11:
            hand1out = ("a Jack")
        elif hand1 == 12:
            hand1out = ("a Queen")
        elif hand1 == 13:
            hand1out = ("a King")
        elif hand1 == 1:
            hand1out = ("an Ace")
        else:
            hand1out = str(hand1)
        if hand2 == 11:
            hand2out = ("a Jack")
        elif hand2 == 12:
            hand2out = ("a Queen")
        elif hand2 == 13:
            hand2out = ("a King")
        elif hand2 == 1:
            hand2out = ("an Ace")
        else:
            hand2out = str(hand2)
        em = discord.Embed(
            title="BlackJack",
            description=f"Your hand is **{hand1out}** and **{hand2out}**",
            colour=0xb3f542)
        await ctx.send("Do you want to stick or twist?")
        again = (await client.wait_for(
            "message", check=lambda m: m.author == user)).content.lower()
        if again == ("stick"):
            pass
        elif again == ("twist"):
            temp = random.randint(1, 13)
            hand3 = temp
            if hand3 == 11:
                hand3out = ("a Jack")
            elif hand3 == 12:
                hand3out = ("a Queen")
            elif hand3 == 13:
                hand3out = ("a King")
            elif hand3 == 1:
                hand3out = ("an Ace")
            else:
                hand3out = str(hand2)
            em = discord.Embed(
                title="BlackJack",
                description=
                f"Your new hand is **{hand1out}**, **{hand2out}** and **{hand3out}**",
                colour=0xb3f542)
            await ctx.send(embed=em)
        else:
            await ctx.send(f"Learn to spell please")
        if hand1 > 10:
            handvalue += 10
        elif hand1 == 1:
            handvalue += 11  # or 1, sort it out later
        else:
            handvalue += hand1
        if hand2 > 10:
            handvalue += 10
        elif hand2 == 1:
            handvalue += 11
        else:
            handvalue += hand2
        if again == ("twist"):
            if hand3 > 10:
                handvalue += 10
            elif hand3 == 1:
                handvalue += 11
            else:
                handvalue += hand3
        if otherhand1 > 10:
            otherhandvalue += 10
        elif otherhand1 == 1:
            otherhandvalue += 11
        else:
            otherhandvalue += otherhand1
        if otherhand2 > 10:
            otherhandvalue += 10
        elif otherhand2 == 1:
            otherhandvalue += 11
        else:
            otherhandvalue += otherhand2

        if otherhandvalue > handvalue:
            await ctx.send(
                f"You have failed, the opponent had {otherhandvalue} and you only had {handvalue}"
            )
            conn, c = connection()
            user = ctx.author
            loss = amount * -1
            get_value(conn, c, user, loss)
            conn.close()
        elif handvalue > otherhandvalue:
            await ctx.send(
                f"You have succeeded, the opponent had {otherhandvalue} and you had {handvalue}"
            )
            conn, c = connection()
            user = ctx.author
            win = amount * 2
            get_value(conn, c, user, win)
            conn.close()
        elif handvalue == otherhandvalue:
            await ctx.send(f"You drew, you both had {handvalue}")
        else:
            await ctx.send(f"Why am I so bad at avoiding bugs?")
    else:
        await ctx.send(f"You need to actually bet something you know")