Пример #1
0
    async def premium(self, ctx):

        db = loads(open("db/users", "r").read())

        if not Tools.has_flag(db, ctx.author, "premium"):

            if ctx.author in self.bot.get_guild(729513002302177311).members:

                db[str(ctx.author.id)]["balance"] += 10000

                db[str(ctx.author.id)]["data"]["tags"].append("premium")

                open("db/users", "w").write(dumps(db, indent=4))

                embed = discord.Embed(
                    title="You have redeemed Prism Premium!",
                    description=
                    "You have gained 10k coins and have a premium badge on your profile.",
                    color=0x0ee323)

                return await ctx.send(embed=embed)

        has_premium = True if Tools.has_flag(db, ctx.author,
                                             "premium") else False

        embed = discord.Embed(
            title="Prism Premium :medal:",
            description=
            f"Bragging rights for everbody :)\nPremium status: {has_premium}",
            color=0x126bf1)

        embed.add_field(
            name="Benefits",
            value=
            ":medal: Exclusive badge on your profile\n:moneybag: Payout of 10k daily coins\n:man_scientist: Access to expirimental commands\n:name_badge: Access to premium-only commands\n:man_artist: Future access to the character customizer",
            inline=False)

        embed.add_field(
            name="How to get premium",
            value=
            "Prism will never be a paid-for bot; which means premium is\ncompletely free.\n\nTo get premium follow these steps:\n1. Join `discord.gg/KhvXWTr`.\n2. Reuse the `premium` command.\n3. Tada, Prism should let you redeem premium. :D",
            inline=False)

        embed.set_author(name=" | Premium", icon_url=self.bot.user.avatar_url)

        embed.set_footer(text=f" | Requested by {ctx.author}.",
                         icon_url=ctx.author.avatar_url)

        return await ctx.send(embed=embed)
Пример #2
0
    async def whitelist(self, ctx, user: discord.User = None):

        if not user:

            return await ctx.send(
                embed=Tools.error("Please specify somebody to whitelist."))

        db = loads(open("db/users", "r").read())

        if not str(user.id) in db or not Tools.has_flag(
                db, user, "blacklisted"):

            return await ctx.send(
                embed=Tools.error(f"{user} isn't blacklisted."))

        db[str(user.id)]["data"]["tags"].remove("blacklisted")

        open("db/users", "w").write(dumps(db, indent=4))

        embed = discord.Embed(title=f"{user} has been whitelisted.",
                              color=0x126bf1)

        embed.set_author(name=" | Whitelist",
                         icon_url=self.bot.user.avatar_url)

        embed.set_footer(text=f" | Whitelisted by {ctx.author}.",
                         icon_url=ctx.author.avatar_url)

        return await ctx.send(embed=embed)
Пример #3
0
    async def sock(self, ctx, user: discord.User = None):

        if Cooldowns.on_cooldown(ctx, "sock"):

            return await ctx.send(embed=Cooldowns.cooldown_text(ctx, "sock"))

        elif not user:

            return await ctx.send(
                embed=Tools.error("No user specified to sock."))

        user = await Tools.getClosestUser(ctx, user)

        db = loads(open("db/users", "r").read())

        if user.id == ctx.author.id:

            return await ctx.send(
                embed=Tools.error("Stop trying to sock yourself."))

        elif not Tools.has_flag(db, ctx.author, "premium"):

            return await ctx.send(
                embed=Tools.error("You need premium to use this command."))

        elif not str(user.id) in db:

            earnings = randint(0, 100)

            db[str(ctx.author.id)]["balance"] += earnings

            open("db/users", "w").write(dumps(db, indent=4))

            embed = discord.Embed(
                title=
                f"You just socked **{user.name}** so hard that they dropped **{earnings} coins**.",
                color=0x126bf1)

            embed.set_author(name=" | Sock", icon_url=self.bot.user.avatar_url)

            embed.set_footer(text=f" | Socked by the great {ctx.author}.",
                             icon_url=ctx.author.avatar_url)

            await ctx.send(embed=embed)

            return await Cooldowns.set_cooldown(ctx, "sock", 300)

        earnings = randint(0, 100)

        db[str(ctx.author.id)]["balance"] += earnings

        db[str(user.id)]["balance"] -= earnings

        open("db/users", "w").write(dumps(db, indent=4))

        embed = discord.Embed(
            title=
            f"You just socked **{user.name}** so hard that they dropped **{earnings} coins**.",
            color=0x126bf1)

        embed.set_author(name=" | Sock", icon_url=self.bot.user.avatar_url)

        embed.set_footer(text=f" | Socked by the great {ctx.author}.",
                         icon_url=ctx.author.avatar_url)

        await ctx.send(embed=embed)

        return await Cooldowns.set_cooldown(ctx, "sock", 300)
Пример #4
0
    async def hotdog(self, ctx, user = None):

        if not user:

            return await ctx.send(embed = Tools.error("Mcbruh, who you tryna hit?"))

        user = await Tools.getClosestUser(ctx, user)

        db = loads(open("db/users", "r").read())

        await ctx.send(str(user))

        if not Tools.has_flag(db, ctx.author, "premium"):

            return await ctx.send(embed = Tools.error("You need premium to use this command."))

        elif not str(user.id) in db:

            return await ctx.send(embed = Tools.error(f"{user.name} does not have a Prism account."))

        _user = db[str(ctx.author.id)]

        __user = db[str(user.id)]
        
        inventory = _user["data"]["inventory"]

        if not "Hotdog" in inventory:

            return await ctx.send(embed = Tools.error("You don't have any hotdogs! Buy some with the ``shop`` command."))

        inventory["Hotdog"]["count"] -= 1

        if inventory["Hotdog"]["count"] == 0:

            inventory.pop("Hotdog")

        if randint(1, 2) == 1:

            amt = randint(100, 1000)

            _user["balance"] += amt

            __user["balance"] -= amt

        else:

            amt = None

        open("db/users", "w").write(dumps(db, indent = 4))

        if amt:

            embed = discord.Embed(title = f"You just threw your hotdog at {user.name}!", description = f"They dropped {amt} coins!", color = 0x126bf1)

        else:

            embed = discord.Embed(title = "Oh no, you threw the hotdog but missed! loser", color = 0x126bf1)

        embed.set_author(name = " | Hotdog", icon_url = self.bot.user.avatar_url)

        embed.set_footer(text = f" | Requested by {ctx.author}.", icon_url = ctx.author.avatar_url)

        return await ctx.send(embed = embed)
Пример #5
0
    async def rob(self, ctx, user: discord.User = None):

        if Cooldowns.on_cooldown(ctx, "rob"):

            return await ctx.send(embed=Cooldowns.cooldown_text(ctx, "rob"))

        elif not user:

            return await ctx.send(
                embed=Tools.error("Please specify somebody to rob."))

        user = await Tools.getClosestUser(ctx, user)

        if user.id == ctx.author.id:

            return await ctx.send(
                embed=Tools.error("Stop trying to rob yourself."))

        elif user.id == self.bot.user.id:

            return await ctx.send(embed=Tools.error("Stop trying to rob me."))

        db = loads(open("db/users", "r").read())

        if not str(user.id) in db:

            return await ctx.send(
                embed=Tools.error(f"{user.name} doesn't have an account."))

        elif db[str(user.id)]["balance"] < 500:

            return await ctx.send(
                embed=Tools.error(f"Bruh, {user.name} is poor."))

        elif db[str(ctx.author.id)]["balance"] < 300:

            return await ctx.send(embed=Tools.error(
                "You need at least 300 coins to rob someone."))

        elif Tools.has_flag(db, user, "protected"):

            return await ctx.send(
                embed=Tools.error(f"{user.name} has a bank lock active."))

        elif randint(0, 1):

            # user wins
            earn = randint(250, round(db[str(user.id)]["balance"] / 2))

            db[str(user.id)]["balance"] -= earn

            db[str(ctx.author.id)]["balance"] += earn

            if len(str(earn)) > 15:

                earn = "∞"

            embed = discord.Embed(
                title="Nice :ok_hand:",
                description=
                f"You just robbed {user.name} and earned `{earn}` coins.",
                color=0x126bf1)

        else:

            # caught
            fee = randint(300, round(db[str(ctx.author.id)]["balance"] / 2))

            db[str(ctx.author.id)]["balance"] -= fee

            embed = discord.Embed(
                title="L O L",
                description=
                f"You failed miserably at robbing {user.name} and got caught!!!111\nYou paid `{fee}` coins as a fee.",
                color=0xFF0000)

        embed.set_author(name=" | Rob", icon_url=self.bot.user.avatar_url)

        embed.set_footer(text=f" | Requested by {ctx.author}.",
                         icon_url=ctx.author.avatar_url)

        open("db/users", "w").write(dumps(db, indent=4))

        await ctx.send(embed=embed)

        return await Cooldowns.set_cooldown(ctx, "rob", 3600)
Пример #6
0
    async def vote(self, ctx):

        if Cooldowns.on_cooldown(ctx, "vote"):

            return await ctx.send(embed=Cooldowns.cooldown_text(ctx, "vote"))

        bot_data = loads(
            requests.get("https://top.gg/api/bots/685550504276787200",
                         headers={
                             "Authorization": self.token
                         }).text)

        base_upvotes = bot_data["points"]

        embed = discord.Embed(
            title="Click here to vote for Prism!",
            description="When your done, send a message in this channel.",
            url="https://top.gg/bot/685550504276787200/vote",
            color=0x126bf1)

        await ctx.send(embed=embed)

        def check(m):

            return m.author == ctx.author and m.channel == ctx.channel

        await self.bot.wait_for("message", check=check)

        embed = discord.Embed(
            title="This might take a few minutes.",
            description=
            "Since the top.gg API doesn't update instantly,\nit might take a minute to verify your vote.",
            color=0x126bf1)

        embed.set_author(name=" | Waiting for change",
                         icon_url=self.bot.user.avatar_url)

        embed.set_footer(text=f" | Requested by {ctx.author}.",
                         icon_url=ctx.author.avatar_url)

        message = await ctx.send(embed=embed)

        failed_attempts = 0

        while failed_attempts < 16:

            bot_data = loads(
                requests.get("https://top.gg/api/bots/685550504276787200",
                             headers={
                                 "Authorization": self.token
                             }).text)

            current_upvotes = bot_data["points"]

            if current_upvotes > base_upvotes:

                db = loads(open("db/users", "r").read())

                db[str(ctx.author.id)]["balance"] = db[str(
                    ctx.author.id)]["balance"] + 2750

                open("db/users", "w").write(json.dumps(db, indent=4))

                embed = discord.Embed(
                    title="Thanks for voting!",
                    description="Since you voted, you get a free $2,750.",
                    color=0x0ee323)

                embed.set_author(name=" | Successful Vote",
                                 icon_url=self.bot.user.avatar_url)

                embed.set_footer(text=" | You can vote every 12 hours.",
                                 icon_url=ctx.author.avatar_url)

                try:

                    await ctx.author.send(embed=embed)

                except:

                    await ctx.send(embed=embed)

                try:

                    await message.delete()

                except:

                    pass

                if Tools.has_flag(db, ctx.author, "premium"):

                    await Cooldowns.set_cooldown(ctx, "vote", 86400)

                    break

                await Cooldowns.set_cooldown(ctx, "vote", 43200)

                break

            await sleep(15)

            failed_attempts += 1