コード例 #1
0
ファイル: reaction.py プロジェクト: MySekwel/Sakila
    async def on_raw_reaction_add(self, payload):
        emoji = payload.emoji
        channel = self.bot.get_channel(payload.channel_id)
        message = await channel.fetch_message(payload.message_id)
        author_id = message.author.id
        if payload.user_id in (self.bot.user.id,
                               author_id) or self.bot.user.id == author_id:
            return
        if emoji.name == emojii.heart["red"] + emojii.special["variant"]:
            if user.get_uid(message.author):
                query = """
                    UPDATE
                    users
                    SET
                    user_love=user_love+?
                    WHERE
                    uid=?
                """
                Connection.SQL_Cursor.execute(
                    query, (1, user.get_uid(message.author)))
                Connection.SQL_Handle.commit()

        if emoji.name == emojii.flower["rosette"] + emojii.special["variant"]:
            if user.get_uid(message.author):
                query = """
                    UPDATE
                    users
                    SET
                    user_reputation=user_reputation+?
                    WHERE
                    uid=?
                """
                Connection.SQL_Cursor.execute(
                    query, (1, user.get_uid(message.author)))
                Connection.SQL_Handle.commit()
コード例 #2
0
ファイル: cryptocurrency.py プロジェクト: MySekwel/Sakila
 async def buy(self, ctx, item):
     if item.casefold() == "rig":
         if user.get_cash(ctx.author) < settings.RIG_PRICE:
             embed = Embed(
                 title="You don't have enough money to buy your first rig!",
                 description="**TIP:** `!mine` to earn easy cash.",
                 colour=Colour.red()
             )
             await ctx.send(embed=embed)
             return
         uid = user.get_uid(ctx.author)
         query = """
             INSERT
             INTO
             crypto(
                 uid,
                 crypto_rig,
                 crypto_wallet,
                 crypto_currency
             )
             VALUES(?, ?, ?, ?)
         """
         Connection.SQL_Cursor.execute(query, (uid, 1, 0, 0))
         Connection.SQL_Handle.commit()
         embed = Embed(
             title="Success",
             description="You have bought a rig! You can now start mining for crypto currencies.",
             colour=Colour.green()
         )
         embed.add_field(
             name=emojii.special["empty"],
             value="**TIP:** You can now use `!crypto download wallet` to download your crypto wallet.",
             inline=True
         )
         await ctx.send(embed=embed)
コード例 #3
0
def slot_inventory(itemname, price, _user, amount=1):
    user.update_cash(_user, price)
    query = f"""
        UPDATE
        inventory
        SET
        {itemname}={itemname}-?
        WHERE
        uid=?
    """
    Connection.SQL_Cursor.execute(query, (amount, user.get_uid(_user)))
    Connection.SQL_Handle.commit()
コード例 #4
0
ファイル: cryptocurrency.py プロジェクト: MySekwel/Sakila
 async def wallet(self, ctx):
     if has_wallet(ctx.author):
         embed = Embed(
             title="ERROR",
             description="You already have a crypto wallet!",
             colour=Colour.red()
         )
         await ctx.send(embed=embed)
         return
     query = """
         UPDATE
         crypto
         SET
         crypto_wallet=?
         WHERE
         uid=?
     """
     Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
     Connection.SQL_Handle.commit()
     await ctx.channel.trigger_typing()
     await asyncio.sleep(2)
     embed = Embed(
         title="Downloading Crypto Wallet",
         description="**Progress:**\n" + ":white_large_square:" * 10,
         colour=Colour.magenta()
     )
     time = datetime.datetime.now()
     embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p"))
     progress = await ctx.send(embed=embed)
     ii = 10
     for i in range(1, 10):
         ii -= 1
         await asyncio.sleep(1)
         embed = Embed(
             title="Downloading Crypto Wallet",
             description=("**Progress:**\n" + ":green_square:" * i) + ":white_large_square:" * ii,
             colour=Colour.magenta()
         )
         time = datetime.datetime.now()
         embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p"))
         await progress.edit(embed=embed)
     await asyncio.sleep(1)
     embed = Embed(
         title="Success!",
         description="Crypto Wallet has been downloaded to your rig.\n\n**Progress:**\n" + "" + ":green_square:" * 10,
         colour=Colour.magenta()
     )
     time = datetime.datetime.now()
     embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p"))
     await progress.edit(embed=embed)
コード例 #5
0
def slot_equipment(itemname, price, _user):
    user.update_cash(_user, price)
    query = f"""
        UPDATE
        equipment
        SET
        {itemname}=?
        WHERE
        uid=?
    """
    Connection.SQL_Cursor.execute(query, (
        0,
        user.get_uid(_user),
    ))
    Connection.SQL_Handle.commit()
コード例 #6
0
ファイル: cryptocurrency.py プロジェクト: MySekwel/Sakila
def has_wallet(_user):
    query = "SELECT crypto_wallet FROM crypto WHERE uid=?"
    Connection.SQL_Cursor.execute(query, (user.get_uid(_user),))
    result = Connection.SQL_Cursor.fetchone()
    Connection.SQL_Handle.commit()
    return int(result[0])
コード例 #7
0
ファイル: cryptocurrency.py プロジェクト: MySekwel/Sakila
def bitcoins(_user):
    query = "SELECT crypto_currency FROM crypto WHERE uid=?"
    Connection.SQL_Cursor.execute(query, (user.get_uid(_user),))
    result = Connection.SQL_Cursor.fetchone()
    Connection.SQL_Handle.commit()
    return float(result[0])
コード例 #8
0
ファイル: cryptocurrency.py プロジェクト: MySekwel/Sakila
    async def mine(self, ctx):
        if not miner(ctx.author):
            await send_notminer_msg(ctx)
            return

        if not has_wallet(ctx.author):
            embed = Embed(
                title="ERROR",
                description="You don't have a crypto wallet!\n**TIP:** `!crypto download wallet`",
                colour=Colour.red()
            )
            await ctx.send(embed=embed)
            return

        alphabet = string.ascii_letters
        rand_letter_1 = random.choices(population=alphabet, k=10)
        rand_letter_2 = random.choices(population=alphabet, k=5)
        rand_letter_3 = random.choices(population=alphabet, k=15)
        joined_ouput = ("".join(rand_letter_1), "".join(rand_letter_2), "".join(rand_letter_3))
        formatted_output = "-".join(joined_ouput)
        embed = Embed(
            title="Decoding hashed equation...",
            description=f"Hash: `{formatted_output.casefold()}`\n\n" + f"**Progress:**\n" + ":white_large_square:" * 10,
            colour=Colour.purple()
        )
        time = datetime.datetime.now()
        embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p"))
        progress = await ctx.send(embed=embed)
        ii = 10
        for i in range(1, 10):
            rand_letter_1 = random.choices(population=alphabet, k=10)
            rand_letter_2 = random.choices(population=alphabet, k=5)
            rand_letter_3 = random.choices(population=alphabet, k=15)
            joined_ouput = ("".join(rand_letter_1), "".join(rand_letter_2), "".join(rand_letter_3))
            formatted_output = "-".join(joined_ouput)
            ii -= 1
            await asyncio.sleep(2)
            embed = Embed(
                title="Decoding hashed equation...",
                description=f"Hash: `{formatted_output.casefold()}`\n\n" + f"**Progress:**\n" + ":green_square:" * i + ":white_large_square:" * ii,
                colour=Colour.purple()
            )
            time = datetime.datetime.now()
            embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p"))
            await progress.edit(embed=embed)
        earnings = "0.000000000000" + str(random.randint(1, 20))
        bitcoin = utils.get(self.bot.emojis, name="bitcoin")
        await asyncio.sleep(2)
        embed = Embed(
            title="Success!",
            description=f"**Equation Solved!**\n" + ":green_square:" * 10 + f"\n\n**Earnings:** {bitcoin}{earnings}",
            colour=Colour.purple()
        )
        time = datetime.datetime.now()
        embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p"))
        embed.set_thumbnail(url="https://cdn.pixabay.com/photo/2015/08/27/11/20/bitcoin-910307_960_720.png")
        await progress.edit(embed=embed)
        query = """
            UPDATE
            crypto
            SET
            crypto_currency=crypto_currency+?
            WHERE
            uid=?
        """
        Connection.SQL_Cursor.execute(query, (earnings, user.get_uid(ctx.author)))
        Connection.SQL_Handle.commit()

        file = open(f"cache/{ctx.author.id}_bitcoin.history", "a")
        file.write(f"{earnings}\n")
        file.close()

        query = """
            SELECT
            record_bitcoin_mined
            FROM
            record
            WHERE
            uid=?
        """
        Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author),))
        result = Connection.SQL_Cursor.fetchone()
        Connection.SQL_Handle.commit()
        if float(result[0]) < float(earnings):
            query = f"UPDATE record SET record_bitcoin_mined={earnings} WHERE uid=?"
            Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author),))
            Connection.SQL_Handle.commit()
コード例 #9
0
ファイル: cryptocurrency.py プロジェクト: MySekwel/Sakila
def miner(_user):
    query = "SELECT * FROM crypto WHERE uid=?"
    Connection.SQL_Cursor.execute(query, (user.get_uid(_user),))
    result = Connection.SQL_Cursor.fetchone()
    Connection.SQL_Handle.commit()
    return result
コード例 #10
0
ファイル: casino.py プロジェクト: MySekwel/Sakila
    async def dice(self, ctx, bet, rolls=2):
        if not user.registered(ctx.author.id):
            await user.send_notregistered_msg(ctx)
        if user.get_cash(ctx.author) >= int(bet):
            embed = Embed(
                title="Rolling Dice...",
                description=
                f"${bet} bet has been placed, {rolls} dice will roll, goodluck!",
                colour=Colour.random())
            embed.set_thumbnail(
                url=
                "https://thumbs.gfycat.com/ElatedImpartialArmadillo-max-1mb.gif"
            )
            message = await ctx.send(embed=embed)
            await asyncio.sleep(5)
            user_result = random.randint(1, 6 * int(rolls))
            dealer_result = random.randint(1, 6 * int(rolls))
            if user_result > dealer_result:
                query = """
                    UPDATE
                    users
                    SET
                    user_cash=?
                    WHERE
                    uid=?
                """
                win = user.get_cash(ctx.author) + int(bet)
                Connection.SQL_Cursor.execute(query,
                                              (win, user.get_uid(ctx.author)))
                Connection.SQL_Handle.commit()

                embed = Embed(
                    title="You won!",
                    description=
                    f"Congratulations, {ctx.author.name}! You've won ${bet}.\n\n**Summary:**\nYour roll: {user_result}\nDealer's Roll: {dealer_result}",
                    colour=Colour.green())
                embed.set_thumbnail(
                    url=
                    "https://media.tenor.com/images/99cff34bdcb675975b2b0cc661f2e4ce/tenor.gif"
                )
                await message.edit(embed=embed)
            elif user_result == dealer_result:
                embed = Embed(
                    title="Draw!",
                    description=
                    f"It's a draw!\n\n**Summary:**\nYour roll: {user_result}\nDealer's Roll: {dealer_result}",
                    colour=Colour.gold())
                embed.set_thumbnail(
                    url=
                    "https://media.tenor.com/images/99cff34bdcb675975b2b0cc661f2e4ce/tenor.gif"
                )
                await message.edit(embed=embed)
            else:
                query = """
                    UPDATE
                    users
                    SET
                    user_cash=?
                    WHERE
                    uid=?
                """
                lost = user.get_cash(ctx.author) - int(bet)
                Connection.SQL_Cursor.execute(query,
                                              (lost, user.get_uid(ctx.author)))
                Connection.SQL_Handle.commit()
                embed = Embed(
                    title="You lost!",
                    description=
                    f"Better luck next Timer, {ctx.author.name}! You've lost ${bet}.\n\n**Summary:**\nYour roll: {user_result}\nDealer's Roll: {dealer_result}",
                    colour=Colour.orange())
                embed.set_thumbnail(
                    url=
                    "https://media.tenor.com/images/2b454269146fcddfdae60d3013484f0f/tenor.gif"
                )
                await message.edit(embed=embed)
        else:
            embed = Embed(
                title="Error",
                description=
                f"You don't have that amount of cash! `!work` to earn more.",
                colour=Colour.red())
            await ctx.send(embed=embed)
コード例 #11
0
    async def buy(self, ctx, item=0):
        if not user.registered(ctx.author.id):
            await user.send_notregistered_msg(ctx)
        # Item: Pickaxe
        # Price: 2500
        # Description: %50 Work Salary Bonus
        if int(item) == 1:
            if user.has_pickaxe(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_PICKAXE:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return
            query = """
                UPDATE
                equipment
                SET
                equipment_pickaxe=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_PICKAXE)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `pickaxe` for ${settings.PRICE_PICKAXE}!")
        # Item: Drill
        # Price: 5000
        # Description: %75 Work Salary Bonus
        elif int(item) == 2:
            if user.has_drill(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_DRILL:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return
            query = """
                UPDATE
                equipment
                SET
                equipment_drill=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_DRILL)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `drill` for ${settings.PRICE_DRILL}!")
        # Item: Jackhammer
        # Price: 15000
        # Description: %100 Work Salary Bonus
        elif int(item) == 3:
            if user.has_jackhammer(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_JACKHAMMER:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return
            query = """
                UPDATE
                equipment
                SET
                equipment_jackhammer=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_JACKHAMMER)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `jackhammer` for ${settings.PRICE_JACKHAMMER}!"
            )
        # Item: Metal Detector
        # Price: 7500
        # Description: %10 Chance of getting valuable metals
        elif int(item) == 4:
            if user.has_metaldetector(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_METALDETECTOR:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return
            query = """
                UPDATE
                equipment
                SET
                equipment_metal_detector=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_METALDETECTOR)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `metal detector` for ${settings.PRICE_METALDETECTOR}!"
            )
        # Item: Gold Detector
        # Price: 15000
        # Description: %20 Chance of getting valuable metals
        elif int(item) == 5:
            if user.has_golddetector(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_GOLDDETECTOR:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return
            query = """
                UPDATE
                equipment
                SET
                equipment_gold_detector=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_GOLDDETECTOR)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `gold detector` for ${settings.PRICE_GOLDDETECTOR}!"
            )
        # Item: Diamond Detector
        # Price: 25000
        # Description: %35 Chance of getting valuable metals / diamonds
        elif int(item) == 6:
            if user.has_diamonddetector(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_DIAMONDDETECTOR:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return
            query = """
                UPDATE
                equipment
                SET
                equipment_diamond_detector=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_DIAMONDDETECTOR)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `diamond detector` for ${settings.PRICE_DIAMONDDETECTOR}!"
            )
        # Item: Mine Cart
        # Price: 35000
        # Description: -%10 Work Cooldown
        elif int(item) == 7:
            if user.has_minecart(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_MINECART:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return
            query = """
                UPDATE
                equipment
                SET
                equipment_minecart=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_MINECART)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `minecart` for ${settings.PRICE_MINECART}!"
            )
        # Item: Mine Transport
        # Price: 55000
        # Description: -%25 Work Cooldown
        elif int(item) == 8:
            if user.has_minetransport(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_MINETRANSPORT:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return
            query = """
                UPDATE
                equipment
                SET
                equipment_minetransport=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_MINETRANSPORT)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `mine transport` for ${settings.PRICE_MINETRANSPORT}!"
            )
        # Item: Transport Plane
        # Price: 150000
        # Description: -%50 Work Cooldown
        elif int(item) == 9:
            if user.has_transportplane(ctx.author) >= 1:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send("ERROR: You already have this item!")
                return
            if user.get_cash(ctx.author) < settings.PRICE_TRANSPORTPLANE:
                await ctx.channel.trigger_typing()
                await asyncio.sleep(2)
                await ctx.send(
                    "ERROR: You don't have any money bud, try working in the mines [!work]"
                )
                return

            query = """
                UPDATE
                equipment
                SET
                equipment_transportplane=?
                WHERE
                uid=?
            """
            Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author)))
            Connection.SQL_Handle.commit()

            user.update_cash(ctx.author, -settings.PRICE_TRANSPORTPLANE)
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(
                f"You have bought a `transport plane` for ${settings.PRICE_TRANSPORTPLANE}!"
            )
        else:
            embed = Embed(title="USAGE:",
                          description="!buy [item id]",
                          colour=Colour.dark_gold())
            await ctx.channel.trigger_typing()
            await asyncio.sleep(2)
            await ctx.send(embed=embed)
コード例 #12
0
ファイル: labor.py プロジェクト: MySekwel/Sakila
    async def work(self, ctx):
        if not user.registered(ctx.author.id):
            await user.send_notregistered_msg(ctx)
            return
        work_salary = 100
        default_salary = 100
        tool = "Shovel"
        metal, gold, diamond = 0, 0, 0

        if user.has_jackhammer(ctx.author):
            tool = "Jackhammer"
            work_salary = default_salary + settings.WORK_SALARY * 1.00
            if user.has_diamonddetector(ctx.author):
                tool += " & Diamond Detector"
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    gold = random.randint(1, 3)
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    diamond = random.randint(1, 2)
            elif user.has_golddetector(ctx.author):
                tool += " & Gold Detector"
                if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
                if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE:
                    gold = random.randint(1, 3)
            elif user.has_metaldetector(ctx.author):
                tool += " & Metal Detector"
                if random.randint(0, 100) < settings.MD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
        elif user.has_drill(ctx.author):
            tool = "Drill"
            work_salary = default_salary + settings.WORK_SALARY * 0.75
            if user.has_diamonddetector(ctx.author):
                tool += " & Diamond Detector"
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    gold = random.randint(1, 3)
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    diamond = random.randint(1, 2)
            elif user.has_golddetector(ctx.author):
                tool += " & Gold Detector"
                if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
                if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE:
                    gold = random.randint(1, 3)
            elif user.has_metaldetector(ctx.author):
                tool += " & Metal Detector"
                if random.randint(0, 100) < settings.MD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
        elif user.has_pickaxe(ctx.author):
            tool = "Pickaxe"
            work_salary = default_salary + settings.WORK_SALARY * 0.50
            if user.has_diamonddetector(ctx.author):
                tool += " & Diamond Detector"
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    gold = random.randint(1, 3)
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    diamond = random.randint(1, 2)
            elif user.has_golddetector(ctx.author):
                tool += " & Gold Detector"
                if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
                if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE:
                    gold = random.randint(1, 3)
            elif user.has_metaldetector(ctx.author):
                tool += " & Metal Detector"
                if random.randint(0, 100) < settings.MD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
        else:
            if user.has_diamonddetector(ctx.author):
                tool += " & Diamond Detector"
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    gold = random.randint(1, 3)
                if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE:
                    diamond = random.randint(1, 2)
            elif user.has_golddetector(ctx.author):
                tool += " & Gold Detector"
                if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)
                if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE:
                    gold = random.randint(1, 3)
            elif user.has_metaldetector(ctx.author):
                tool += " & Metal Detector"
                if random.randint(0, 100) < settings.MD_VALUABLE_CHANCE:
                    metal = random.randint(1, 5)

        mining = utils.get(self.bot.emojis, name="mining")
        embed = Embed(title=f"{str(mining)}Mining in Progress...",
                      description=f"**Current Tool**: {tool}",
                      colour=Colour.random())
        progress = await ctx.send(embed=embed)
        await asyncio.sleep(15)
        embed = Embed(
            title="Mining Finished!",
            description=f"**You have worked in the mines and earned**\n\
                **Salary:** `${int(work_salary)}`\n\
                **EXP:** `{settings.WORK_BONUS}`\n\
                **Metal:** `{metal}`\n\
                **Gold:** `{gold}`\n\
                **Diamond:** `{diamond}`",
            colour=Colour.green())
        await progress.edit(embed=embed)

        user.update_cash(ctx.author, work_salary)
        user.update_exp(ctx.author, settings.WORK_BONUS)

        query = """
            UPDATE
            inventory
            SET
            metal_metal=metal_metal+?,
            metal_gold=metal_gold+?,
            metal_diamond=metal_diamond+?
            WHERE
            uid=?
        """
        values = (metal, gold, diamond, user.get_uid(ctx.author))
        Connection.SQL_Cursor.execute(query, values)
        Connection.SQL_Handle.commit()

        query = """
            SELECT
            record_metal_mined,
            record_gold_mined,
            record_diamond_mined
            FROM
            record
            WHERE
            uid=?
        """
        Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author), ))
        result = Connection.SQL_Cursor.fetchone()
        Connection.SQL_Handle.commit()
        fetched_metal, fetched_gold, fetched_diamonds = int(result[0]), int(
            result[1]), int(result[2])
        if fetched_metal < metal:
            query = f"UPDATE record SET record_metal_mined={metal} WHERE uid=?"
            Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author), ))
            Connection.SQL_Handle.commit()
        if fetched_gold < gold:
            query = f"UPDATE record SET record_gold_mined={gold} WHERE uid=?"
            Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author), ))
            Connection.SQL_Handle.commit()
        if fetched_diamonds < diamond:
            query = f"UPDATE record SET record_diamond_mined={diamond} WHERE uid=?"
            Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author), ))
            Connection.SQL_Handle.commit()