Example #1
0
    async def server(self, ctx):

        information = f"""
            Name: {ctx.guild.name}
            Server owner: {ctx.guild.owner.name}
            Member count: {ctx.guild.member_count}
            Region: {ctx.guild.region}
            Verification level: {Tools.uppercase(str(ctx.guild.verification_level))}
            Created on: {ctx.guild.created_at.__format__('%A, %d. %B %Y, at %H:%M:%S')}
            Role count: {len(ctx.guild.roles) - 1}
            Emoji count: {len(ctx.guild.emojis)}
        """

        embed = discord.Embed(title=Tools.uppercase(ctx.guild.name),
                              color=0x126bf1)

        embed.add_field(name="Information", value=information, inline=False)

        embed.set_image(url=ctx.guild.icon_url)

        embed.set_author(name=" | Server Information",
                         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)
Example #2
0
    async def shop(self, ctx):
        
        db = loads(open("db/guilds", "r").read())

        user = loads(open("db/users", "r").read())[str(ctx.author.id)]
        
        items = loads(open("assets/res/items.json", "r").read())

        categories = {}

        for item in items:

            if not items[item]["cat"] in categories:

                categories[items[item]["cat"]] = {}

            categories[items[item]["cat"]][item] = items[item]

        prefix = db[str(ctx.guild.id)]["prefix"]
        
        embed = discord.Embed(description = f"Some of the world's most useful items.\nUse ``{prefix}buy [item id]`` to purchase an item.\nFor example, ``{prefix}buy 1`` would buy a Pizza Slice.", color = 0x126bf1)

        for category in categories:

            text = ""

            for item in categories[category]:

                _item = categories[category][item]

                if not "premium" in _item["tags"] or "premium" in _item["tags"] and "premium" in user["data"]["tags"]:

                    text += f"[{item}] {_item['name']} ({_item['price']} coins) \n"

            embed.add_field(name = Tools.uppercase(category), value = text, inline = False)

        embed.set_author(name = " | Item Shop", 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)
Example #3
0
    async def eightball(self, ctx, *, question=None):

        if not question:

            return await ctx.send(embed=Tools.error("No question specified."))

        for member in ctx.message.mentions:

            question = question.replace(f"<@!{member.id}>", member.name)

        responses = [
            "It is certain.", "It is decidedly so.", "Without a doubt.",
            "Yes - definitely.", "You may rely on it.", "As I see it, yes.",
            "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.",
            "Reply hazy, try again.", "Ask again later.",
            "Better not tell you now.", "Cannot predict now.",
            "Concentrate and ask again.", "Don't count on it.",
            "My reply is no.", "My sources say no.", "Outlook not so good.",
            "Very doubtful."
        ]

        if not question.endswith("?"):

            question = f"{question}?"

        question = Tools.uppercase(question)

        question = question.replace(" i ", " I ")

        embed = discord.Embed(title=question,
                              description=choice(responses),
                              color=0x126bf1)

        embed.set_author(name=" | Eightball",
                         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)
Example #4
0
    async def adopt(self, ctx, *, pet=None):

        if not pet:

            pets, c = "", 1

            for pet in self.pets:

                pets += f"[{c}] {self.pets[pet]['emoji']} {Tools.uppercase(pet)} (${self.pets[pet]['price']})\n"

                c += 1

            embed = discord.Embed(
                title="Prism Pet Shop",
                description="The cutest pets on planet discord!",
                color=0x126bf1)

            embed.add_field(name="Pets", value=pets, inline=False)

            embed.add_field(
                name="How to adopt",
                value=
                "To adopt a pet, either use:\n``adopt [pet name]``\nor use\n``adopt [pet id]``"
            )

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

            return await ctx.send(embed=embed)

        pet = pet.lower()

        try:

            id = int(pet) - 1

            if id < 0:

                return await ctx.send(embed=Tools.error("Invalid pet ID!"))

            pets = []

            for _pet in self.pets:

                pets.append(_pet)

            try:

                pet = pets[id]

            except:

                return await ctx.send(embed=Tools.error("Invalid pet ID!"))

        except:

            if not pet in self.pets:

                return await ctx.send(
                    embed=Tools.error("That isn't a valid pet!"))

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

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

        if user["pet"]["level"]:

            return await ctx.send(embed=Tools.error(
                "You already have a pet, get rid of it using the ``shelter`` command."
            ))

        elif not user["balance"] >= self.pets[pet]["price"]:

            more = self.pets[pet]["price"] - user["balance"]

            return await ctx.send(
                embed=Tools.error(f"You need ${more} more to buy a pet {pet}!")
            )

        user["balance"] -= self.pets[pet]["price"]

        user["pet"]["level"] = 1

        user["pet"]["type"] = pet

        user["pet"]["name"] = "Unnamed " + Tools.uppercase(pet)

        user["pet"]["adopted_on"] = str(date.today())

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

        embed = discord.Embed(
            title="Adoption Successful!",
            description=
            f"Have fun with your new pet {pet}.\n\n(you can name it with the ``name`` command)",
            color=0x0ee323)

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

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

        return await ctx.send(embed=embed)