Ejemplo n.º 1
0
 async def _reload(self, ctx: commands.Context, name: str = None):
     if not name:
         await ctx.send(embed=qEmbed(title="You didn't provide the name of the extension"))
     if name:
         self.bot.unload_extension("cogs." + name)
         self.bot.load_extension("cogs." + name)
         await ctx.send(embed=qEmbed(title=f"Successfully reloaded the `{name}` extension."))
Ejemplo n.º 2
0
    async def on_message(self, message: discord.Message):
        if message.channel.id in ShowCaseChannelsID:
            e = qEmbed(
                title="**Don't Chat!**",
                description=
                f"・<#{message.channel.id}> is a channel strictly to **showcase your {message.channel.name.strip('・showcase-').upper()} work** 😅\n・Chatting here/passing comments is **not allowed** 🙇🏻‍♂️"
            )
            e2 = qEmbed(
                title="**One at a time!**",
                description=
                f"・{message.author.mention}, please showcase your work **one by one**!・This is to ensure that each of your work gets attention and not gets skipped over!"
            )
            if message.author.bot:
                return
            regex = r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))"
            url = re.findall(regex, message.clean_content)
            urls = [x[0] for x in url]
            if len(urls) >= 1:
                await message.add_reaction('⭐')
            elif message.attachments:
                if len(message.attachments) == 1:
                    await message.add_reaction('⭐')
                elif len(message.attachments) > 1:
                    try:
                        await message.author.send(embed=e2)
                    except Exception as e:
                        if isinstance(e, discord.Forbidden):
                            await message.channel.send(embed=e,
                                                       delete_after=10)
            else:
                try:
                    await message.delete()
                    await message.author.send(embed=e)
                except Exception as e:
                    if isinstance(e, discord.Forbidden):
                        await message.channel.send(embed=e, delete_after=10)
                    elif isinstance(e, discord.NotFound):
                        pass
                    else:
                        await message.channel.send(e, delete_after=5)
                        raise e

        else:
            return None
Ejemplo n.º 3
0
 async def profile(self,
                   ctx: commands.Context,
                   seller: discord.Member = None):
     seller = ctx.author if not seller else seller
     if not seller:
         query = "SELECT * FROM profiles WHERE user_id = $1"
         data = await self.bot.pool.fetch(query, seller.id)
         # print(data)
         if data:
             e = self.profileEmbed(data[0], seller)
             return await ctx.send(embed=e)
         if not data:
             return await ctx.send(embed=qEmbed(
                 title=f"{seller.display_name} is not a verified seller"))
     if seller:
         query = "SELECT * FROM profiles WHERE user_id = $1"
         data = await self.bot.pool.fetch(query, seller.id)
         if data:
             e = self.profileEmbed(data[0], seller)
             return await ctx.send(embed=e)
         if not data:
             return await ctx.send(embed=qEmbed(
                 title=f"{seller.display_name} is not a verified seller"))
Ejemplo n.º 4
0
 async def gfx(self, ctx: commands.Context) :
     if ctx.invoked_subcommand is None :
         cog: commands.Cog = self.bot.get_cog('gfx')
         e = qEmbed(title="GFX Category")
         for command in cog.walk_commands() :
             if not isinstance(command, commands.Group) :
                 e.add_field(
                     name=f".{command.full_parent_name} {command.name} {command.signature}",
                     value="⮑  " + command.help,
                     inline=False
                 )
         # e.set_footer(text=self.bot.user.name, icon_url=self.bot.user.avatar_url)
         return await ctx.send(embed=e)
     else :
         pass
Ejemplo n.º 5
0
    async def on_member_remove(self, member : discord.Member):
        time = getReadableTimeBetween(member.joined_at.timestamp(), datetime.datetime.utcnow().timestamp())
        time_split = time.split(",")
        try:
            e2 = qEmbed(title="\😥***Sad to see you go***", url='https://top.gg/servers/715126942294343700', description=f'・Thanks for being in our server for {time_split[0]+" and"+time_split[1]}.\n'
                                                                        f'・If incase you change your mind, here is the invite link \🥺\n'
                                                                        f'・https://www.discord.gg/nT7kQe6jUE')
            await member.send(member.mention, embed=e2)
        except:
            pass
        channel = self.bot.get_channel(modLogsChannelId)

        e = discord.Embed(title="Member Left", color=main_color)
        e.description = f"• **Name**: {member.mention}\n" \
                        f"• **Joined at**: {time_split[0] + ' and' + time_split[1]} ago.\n" \
                        f"• **Roles ({len(member.roles[1:])})**: {', '.join(x.mention for x in member.roles[1:])}"
        e.set_author(name=str(member), icon_url=member.avatar_url)
        e.set_footer(text=self.bot.user.name, icon_url=ArtiFeZGuildIconUrl)
        return await channel.send(embed=e)
Ejemplo n.º 6
0
 def profileEmbed(self, data, user: discord.Member):
     # print(data)
     e = qEmbed(title=data["profession"],
                description=data["bio"]).set_author(
                    name=str(user),
                    icon_url=user.avatar_url).set_image(url=data["banner"])
     twitter = json.loads(data["socials"])["twitter"]
     insta = json.loads(data["socials"])["instagram"]
     uh = '\n'
     if twitter or insta or twitter and insta:
         e.add_field(
             name="Socials",
             value=
             f"{f'[Twitter]({twitter})' if twitter else ''}{uh if insta else ''}{f'[Instagram]({insta})' if insta else ''}"
         )
     e.description = data['bio']
     e.add_field(name="Commissions",
                 value="Open" if data['commissions_open'] else "Closed")
     e.add_field(name="Portfolio", value=data['portfolio'], inline=False)
     return e
Ejemplo n.º 7
0
    async def register(self, ctx: commands.Context):
        """Registers a member as a verified seller on the server."""
        """
        Table "profiles"
        user_id : bigint
        bio : str
        profession : str
        socials : jsonb => {str(social_name) : str(social_url)}
        portfolio : str
        commissions_open : bool
        banner : str
        registered_at : datetime
        """
        try:
            await ctx.message.add_reaction("✉")
            initial_msg = await ctx.author.send(embed=qEmbed(
                title="Starting the registering process",
                description="Please answer all the questions correctly"
                "and honestly.").set_author(name=str(ctx.author),
                                            icon_url=ctx.author.avatar_url))
            channel: discord.TextChannel = initial_msg.channel
            await channel.send(embed=qEmbed(
                title="What is your profession?",
                description=
                "**Examples:** Graphic Designer, Visual Editor, Motion Graphics Designer, etc."
            ))
            profession_msg: discord.Message = await self.bot.wait_for(
                'message',
                timeout=240,
                check=lambda m: m.channel.id == channel.id and m.author.id ==
                ctx.author.id and len(m.content) < 60)
            profession = profession_msg.content
            # available_socials = ["Twitter", "Instagram", "Behance", "Dribbble", "FaceBook", "ArtStation", "DevianArt"]
            await channel.send(embed=qEmbed(
                title="Reply with a short bio.",
                description=
                "Reply with a bio about yourself for your profile, tell people things like "
                "the work you do and since you have been doing it, etc."))
            bio_msg: discord.Message = await self.bot.wait_for(
                'message',
                timeout=240,
                check=lambda m: m.channel.id == channel.id and m.author.id ==
                ctx.author.id)
            bio = bio_msg.content
            await channel.send(embed=qEmbed(
                title="Are you on Twitter?",
                description=
                "If yes, reply with the **link to your twitter profile**.\n"
                "If not, reply with **`no`**.",
            ))
            twitter_regex = r"(?:http:\/\/)?(?:www\.)?twitter\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)"
            twitter_msg: discord.Message = await self.bot.wait_for(
                'message',
                timeout=240,
                check=lambda m: m.channel.id == channel.id and m.author.id ==
                ctx.author.id)
            twitter_url = ''
            if twitter_msg.content.lower().startswith("no"):
                twitter_url = None

            twitter_url2 = re.findall(twitter_regex, twitter_msg.content)
            if twitter_url == '':
                if not twitter_url2:
                    twitter_url = None
                elif twitter_url2[0] == '':
                    twitter_url = None
                else:
                    twitter_url = twitter_url2[0]
            # print(twitter_url)
            await channel.send(embed=qEmbed(
                title="Are you on Instagram?",
                description=
                "If yes, reply with the **link to your instagram profile**.\n"
                "If not, reply with **`no`**.",
            ))
            insta_regex = r"(?:(?:http|https):\/\/)?(?:www\.)?(?:instagram\.com|instagr\.am)\/([A-Za-z0-9-_\.]+)"
            insta_msg: discord.Message = await self.bot.wait_for(
                'message',
                timeout=240,
                check=lambda m: m.channel.id == channel.id and m.author.id ==
                ctx.author.id)
            insta_url = ''
            if insta_msg.content.lower().startswith("no"):
                insta_url = None

            insta_url2 = re.findall(insta_regex, insta_msg.content)
            if insta_url == '':
                if not insta_url2:
                    insta_url = None
                elif insta_url2[0] == '':
                    insta_url = None
                else:
                    insta_url = insta_url2[0]
            await channel.send(embed=qEmbed(
                title="Please link your portfolio",
                description=
                "**Recommended:** Behance, YouTube Playlist, Dribbble, etc."))
            url_regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)"
            port_msg: discord.Message = await self.bot.wait_for(
                'message',
                timeout=240,
                check=lambda m: m.channel.id == channel.id and m.author.id
                == ctx.author.id and len(
                    re.findall(url_regex, m.content.lower())) == 1)
            portfolio = port_msg.content
            await channel.send(
                embed=qEmbed(title="Are your commissions open?",
                             description="If yes, reply with **`yes`**.\n"
                             "If not, reply with **`no`**."))
            open_msg: discord.Message = await self.bot.wait_for(
                'message',
                timeout=240,
                check=lambda m: m.channel.id == channel.id and m.author.id ==
                ctx.author.id and m.content.lower() in ["yes", "no"])
            open = bool
            if open_msg.content.lower() == "yes":
                open = True
            else:
                open = False
            await channel.send(embed=qEmbed(
                title="Please reply with a profile banner",
                description=
                "Reply with **__a web link__** to your profile banner**.\n"
                "Ideal aspect ratio is 2:1."))
            banner_msg: discord.Message = await self.bot.wait_for(
                'message',
                timeout=240,
                check=lambda m: m.channel.id == channel.id and m.author.id
                == ctx.author.id and len(
                    re.findall(url_regex, m.content.lower())) == 1)
            banner_url = banner_msg.content
            Twitter = ("https://twitter.com/" +
                       twitter_url) if twitter_url is not None else None
            Insta = ("https://instagram.com/" +
                     insta_url) if insta_url is not None else None
            socials = json.dumps({"twitter": Twitter, "instagram": Insta})
            # await channel.send(f"Socials:\n"
            #                    f"{socials}\n"
            #                    f"Banner:\n"
            #                    f"{banner_url}\n"
            #                    f"Portfolio:\n"
            #                    f"{portfolio}\n"
            #                    f"Profession:\n"
            #                    f"{profession}\n"
            #                    f"Commissions Open:\n"
            #                    f"{open}")

            query = "INSERT INTO profiles (user_id, socials, profession, portfolio, commissions_open, banner, registered_at, bio)" \
                    "VALUES ($1, $2, $3, $4, $5, $6, $7, $8)"
            await self.bot.pool.execute(query, ctx.author.id, socials,
                                        profession, portfolio,
                                        open, banner_url,
                                        datetime.datetime.utcnow(), bio)
            await banner_msg.add_reaction("✅")
            await ctx.message.add_reaction("✅")
            await channel.send(embed=qEmbed(
                title="Successfully registered your profile!",
                description="To view the profile, type `.profile`.\n"
                "To edit the profile, type `.help set`."))

        except Exception as e:
            if isinstance(e, asyncio.TimeoutError):
                await ctx.send(embed=qEmbed(
                    title="You did not answer in time!",
                    description=
                    "You can still retry by running the command again.",
                    color=discord.Color.red()))
            elif isinstance(e, discord.Forbidden):
                await ctx.send(
                    embed=qEmbed(title="Please open your DMs and try again",
                                 color=discord.Color.red()))
            else:
                raise e
Ejemplo n.º 8
0
    async def on_member_join(self, member: discord.Member):
        await member.add_roles(discord.Object(CommunityRoleID))
        channel = self.bot.get_channel(chatChannelId)
        time = getReadableTimeBetween(member.created_at.timestamp(),
                                      datetime.datetime.utcnow().timestamp())
        time_split = time.split(",")
        e = qEmbed(title="New Member!")
        e.description = f"• **Name**: {member.mention}\n" \
                        f"• **Account Created**: {time_split[0] + ' and ' + time_split[1]} ago.\n" \
                        f"• **Lucky Number**: {random.randint(1, 10)} <a:afzparty_blob:783393007075459133>"
        e.set_author(name=str(member), icon_url=member.avatar_url)
        await channel.send(embed=e)
        e2 = qEmbed(title='***Welcome to ArtiFeZ!***',
                    color=main_color,
                    url='https://top.gg/servers/715126942294343700')
        e2.description = AboutUs
        e2.add_field(
            name="What We Offer",
            value="""・Frequent Editing Competitions with **Cash Prizes**!
・**Active** Community!
・**Level Based** and **Color** Roles!
・Special **Server Booster Perks**!
・Many people who give opinions on your work!
・A platform to share your work and **get recognized** in the community!""",
            inline=False)
        e2.add_field(name="Quick start",
                     value="""
・**Reply with one of the following options to have info regarding the same.**
・:one: - I want something made by someone \💵
・:two: - I want to offer/sell my services to others \🌻
・:three: - I want suggestions on my work \🤔
・:four: - I need technical help with my design/software \⚙️
・:five: - I want to showcase my work to the community \👀
・:six: - Let us know instead, contact staff \💁🏻‍♂️
・:seven: - I am here just to chill \😎
        """)
        try:
            tries = 7
            try:
                init = await member.send(embed=e2, content=member.mention)
            except:
                return

            def check(m: discord.Message):
                return m.author == member and m.channel == init.channel and m.content.startswith(
                    tuple([str(x) for x in range(1, 8)]))

            while tries > 0:
                msg: discord.Message = await self.bot.wait_for('message',
                                                               check=check)
                if '1' in msg.content:
                    tries -= 1
                    e1 = qEmbed(
                        title='\😅***Not quite there yet..***',
                        url='https://top.gg/servers/715126942294343700')
                    e1.description = "・The commission system is currently **under development**.\n" \
                                     "・The buyers will be able to **buy services** from the **verified sellers** of ArtiFeZ.\n" \
                                     "・There is no ETA as of now, but it will be out **before 15th December 2020**.\n" \
                                     f"・You can still **reply with another number** ( {tries} attempts left )"
                    await init.channel.send(embed=e1)
                elif '2' in msg.content:
                    tries -= 1
                    e2 = qEmbed(
                        title='\😅***Not quite there yet..***',
                        url='https://top.gg/servers/715126942294343700')
                    e2.description = "・The commission system is currently **under development**.\n" \
                                     "・The buyers will be able to **buy services** from the **verified sellers** of ArtiFeZ.\n" \
                                     "・There is no ETA as of now, but it will be out **before 15th December 2020**.\n" \
                                     f"・You can still **reply with another number** ( {tries} attempts left )"
                    await init.channel.send(embed=e2)
                    continue
                elif '3' in msg.content:
                    tries -= 1
                    e3 = qEmbed(
                        title="\💁🏻‍♂️***Sure Thing!***",
                        url='https://top.gg/servers/715126942294343700')
                    e3.add_field(
                        name='If you are a GFX Designer:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎨 emoji to get the <@&716245903203106816> role.\n"
                        "・You can also react with 🖌 to get the <@&769919914060021770> role. [Optional]\n"
                        "・Now, you can head over to <#765052924073082911> and share your work.\n"
                        "・If you took the <@&769919914060021770> role, you can ping the same role as well afterwards.\n"
                        "・And, that's pretty much it!",
                        inline=False)
                    e3.add_field(
                        name='If you are a VFX Editor:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎥 emoji to get the <@&716246064306323577> role.\n"
                        "・You can also react with 📽 to get the <@&769920213453504514> role. (Optional)\n"
                        "・Now, you can head over to <#765054200647254016> and share your work.\n"
                        "・If you took the <@&769920213453504514> role, you can ping the same role as well afterwards.\n"
                        "・And, that's pretty much it!",
                        inline=False)
                    e3.add_field(
                        name='If you are a SFX Producer:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎵 emoji to get the <@&716246158087028736> role.\n"
                        "・Now, you can head over to <#769955894456221696> and share your work.\n"
                        "・And, that's pretty much it!",
                        inline=False)
                    e3.add_field(
                        name='Anything Else?',
                        value=
                        f'You can still reply with any other number. ( {tries} attempts left )',
                        inline=False)
                    await init.channel.send(embed=e3)
                    continue
                elif '4' in msg.content:
                    tries -= 1
                    e4 = qEmbed(
                        title="\💁🏻‍♂️***Leave it to us!***",
                        url='https://top.gg/servers/715126942294343700')
                    e4.add_field(
                        name='If you need help in GFX:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎨 emoji to get the <@&716246064306323577> role.\n"
                        "・Now, you can head over to <#765054240443596841> and ask for help.\n"
                        "・Please be patient after asking for help.\n"
                        "・Although we try our best to assist everyone, its not guaranteed that you will be assisted.\n"
                        "・And, that's about it!",
                        inline=False)
                    e4.add_field(
                        name='If you need help in VFX:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎥 emoji to get the <@&716245903203106816> role.\n"
                        "・Now, you can head over to <#765053215162892309> and ask for help.\n"
                        "・Please be patient after asking for help.\n"
                        "・Although we try our best to assist everyone, its not guaranteed that you will be assisted.\n"
                        "・And, that's about it!",
                        inline=False)
                    e4.add_field(
                        name='If you need help in SFX:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎵 emoji to get the <@&716246158087028736> role.\n"
                        "・Now, you can head over to <#769955894087516160> and ask for help.\n"
                        "・Please be patient after asking for help.\n"
                        "・Although we try our best to assist everyone, its not guaranteed that you will be assisted.\n"
                        "・And, that's about it!",
                        inline=False)
                    e4.add_field(
                        name='Anything Else?',
                        value=
                        f'You can still reply with any other number. ( {tries} attempts left )',
                        inline=False)
                    await init.channel.send(embed=e4)
                    continue
                elif '5' in msg.content:
                    tries -= 1
                    e5 = qEmbed(
                        title="\💫***Gotcha!***",
                        url='https://top.gg/servers/715126942294343700')
                    e5.add_field(
                        name='If you are a GFX Designer:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎨 emoji to get the <@&716245903203106816> role.\n"
                        "・Now, you can head over to <#765052924073082911> and start sharing your work!\n"
                        "・And, that's about it!",
                        inline=False)
                    e5.add_field(
                        name='If you are a VFX Editor:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎥 emoji to get the <@&716246064306323577> role.\n"
                        "・Now, you can head over to <#765054200647254016> and start sharing your work!\n"
                        "・And, that's about it!",
                        inline=False)
                    e5.add_field(
                        name='If you are a SFX Producer:',
                        value=
                        "・Head over to <#715205304303747142> and go to [this message](https://discordapp.com/channels/715126942294343700/715205304303747142/769925228896976896).\n"
                        "・On the message, [react](https://discordapp.fandom.com/wiki/Reactions#:~:text=To%20react%2C%20users%20must%20mouse,emojis%20present%20in%20the%20menu.) with the 🎵 emoji to get the <@&716246158087028736> role.\n"
                        "・Now, you can head over to <#769955894456221696> and share your work.\n"
                        "・And, that's pretty much it!",
                        inline=False)
                    e5.add_field(
                        name='Anything Else?',
                        value=
                        f'You can still reply with any other number. ( {tries} attempts left )',
                        inline=False)
                    await init.channel.send(embed=e5)
                    continue
                elif '6' in msg.content:
                    tries -= 1
                    e6 = qEmbed(
                        title="\📨 ***Hello There!***",
                        url="https://top.gg/servers/715126942294343700")
                    e6.add_field(
                        name="More Help",
                        value=
                        f"・You can head over to either <#715851273571794965> or <#765059841890320394> and tag the <@&765531157721776148>.\n"
                        f"・Glad you are here! \🥂")
                    e6.add_field(
                        name='Anything Else?',
                        value=
                        f'You can still reply with any other number. ( {tries} attempts left )',
                        inline=False)
                    await init.channel.send(embed=e6)
                    continue
                elif '7' in msg.content:
                    tries -= 1
                    e7 = qEmbed(
                        title="\💁🏻‍♂️ ***Alright then!***",
                        url="https://top.gg/servers/715126942294343700")
                    e7.description = "・Sure thing, we hope you have a great time here in ArtiFeZ!\n" \
                                     "・Great to have you here! \🥂"
                    e7.add_field(
                        name='Anything Else?',
                        value=
                        f'You can still reply with any other number. ( {tries} attempts left )',
                        inline=False)
                    await init.channel.send(embed=e7)
                    continue
                else:
                    tries -= 1
                    await init.channel.send(
                        f"`{msg.content if len(msg.content) <= 1750 else 'A really long message'}` is not an valid option! ( {tries} attempts left )"
                    )
                    continue
            await init.channel.send(
                "You have used all your attempts. If you still have any questions, you can head over to <#765059841890320394> and tag the <@&765531157721776148>."
            )
        except Exception as e:
            if isinstance(e, asyncio.TimeoutError):
                await member.send('You did not reply in time.')
            else:
                videro = self.bot.get_user(331084188268756993)
                await videro.send(f'Welcome System Error:\n'
                                  f'```py\n{e}\n```')
                await member.send(
                    f'I ran into an error! The developer has been informed.\n'
                    f'Error :\n'
                    f'```\n{e}\n```')
                raise e
Ejemplo n.º 9
0
 async def _set(self,
                ctx: commands.Context,
                thing: str = None,
                *,
                value: str = None):
     help_embed = qEmbed(title=f"❎ Incorrect usage")
     help_embed.add_field(name="Correct usage:",
                          value=f"`.set <thing> <value>`\n"
                          f"`.set portfolio https://behance.net/vxdro`\n"
                          f"`.set commissions closed`\n"
                          f"`.set banner_url https://ibb.co/whatever`",
                          inline=False).add_field(name="Available Options:",
                                                  value="bio\n"
                                                  "profession\n"
                                                  "twitter\n"
                                                  "instagram\n",
                                                  inline=True).add_field(
                                                      name="⠀",
                                                      value="portfolio\n"
                                                      "commissions\n"
                                                      "banner")
     if not thing:
         return await ctx.send(embed=help_embed)
     if not value:
         return await ctx.send(embed=help_embed)
     if thing and value:
         user_id = str(ctx.author.id)
         valid_things = [
             "bio", "profession", "twitter", "instagram", "portfolio",
             "commissions", "banner"
         ]
         if thing.lower() not in valid_things:
             ee = help_embed
             ee.title = "❎ Wrong thing entered!"
             return await ctx.send(embed=ee)
         if thing.lower() == "bio":
             query = "UPDATE profiles SET bio = $1 WHERE user_id = $2"
             await self.bot.pool.execute(query, value, user_id)
             return await ctx.message.add_reaction("✅")
         if thing.lower() == "profession":
             query = "UPDATE profiles SET profession = $1 WHERE user_id = $2"
             await self.bot.pool.execute(query, value, user_id)
             return await ctx.message.add_reaction("✅")
         if thing.lower() == "twitter":
             data = await self.bot.pool.fetch(
                 "SELECT * from profiles WHERE user_id = $1", user_id)
             socials = json.loads(data[0]["socials"])
             socials["twitter"] = value
             query = "UPDATE profiles SET socials = $1 WHERE user_id = $2"
             await self.bot.pool.execute(query, json.dumps(socials),
                                         user_id)
             return await ctx.message.add_reaction("✅")
         if thing.lower() == "instagram":
             data = await self.bot.pool.fetch(
                 "SELECT * from profiles WHERE user_id = $1", user_id)
             socials = json.loads(data[0]["socials"])
             socials["instagram"] = value
             query = "UPDATE profiles SET socials = $1 WHERE user_id = $2"
             await self.bot.pool.execute(query, json.dumps(socials),
                                         user_id)
             return await ctx.message.add_reaction("✅")
         if thing.lower() == "portfolio":
             query = "UPDATE profiles SET portfolio = $1 WHERE user_id = $2"
             await self.bot.pool.execute(query, value, user_id)
             return await ctx.message.add_reaction("✅")
         if thing.lower() == "commissions":
             if "close" in value.lower():
                 commissions_open = False
             elif "open" in value.lower():
                 commissions_open = True
             else:
                 commissions_open = False
             query = "UPDATE profiles SET commissions_open = $1 WHERE user_id = $2"
             await self.bot.pool.execute(query, commissions_open, user_id)
             return await ctx.message.add_reaction("✅")
         if thing.lower() == "banner":
             query = "UPDATE profiles SET banner = $1 WHERE user_id = $2"
             await self.bot.pool.execute(query, value, user_id)
             return await ctx.message.add_reaction("✅")
         else:
             pass
Ejemplo n.º 10
0
    async def _help(self, ctx, *arg: str):
        if arg:
            for cog in self.client.cogs:
                cog1 = self.client.get_cog(cog)
                for command in cog1.walk_commands():
                    if len(arg) > 1:
                        if command.qualified_name == arg[0] + ' ' + arg[1]:
                            command1 = self.client.get_command(
                                command.qualified_name)
                            help_embed = discord.Embed(color=main_color)
                            help_embed.add_field(
                                name='.' + command1.name,
                                value="└─ " + command1.help,
                                inline=False).add_field(
                                    name=f'Usage',
                                    value='.' + command.qualified_name + ' ' +
                                    command1.signature,
                                    inline=False)
                            await ctx.send(embed=help_embed)
                            return

            cog1 = self.client.get_cog(name=arg[0])
            if cog1:
                help_embed = qEmbed(title="Category " + arg[0].title())
                for command1 in cog1.walk_commands():
                    if isinstance(command1, commands.Group):
                        pass
                    if not command1.parent and not isinstance(
                            command1, commands.Group):
                        help_embed.add_field(name="." + command1.name + ' ' +
                                             command1.signature,
                                             value="└─ " + str(command1.help),
                                             inline=False)
                    if command1.parent:
                        help_embed.add_field(
                            name="." + f"{command1.full_parent_name} " +
                            command1.name + ' ' + command1.signature,
                            value="└─ " + str(command1.help),
                            inline=False)
                await ctx.send(embed=help_embed)
                return

            command2 = self.client.get_command(name=arg[0])
            if command2:
                help_embed = qEmbed(title="Robo-ArtiFeZ Help!")
                help_embed.add_field(name='.' + command2.name,
                                     value=command2.help,
                                     inline=False)
                help_embed.add_field(name=f'Usage',
                                     value='.' + command2.name + ' ' +
                                     command2.signature,
                                     inline=False)
                help_embed.add_field(
                    name=f'Category',
                    value=command2.cog.qualified_name.title()
                    if command2.cog is not None else 'No Category')
                await ctx.send(embed=help_embed)
                return

        else:
            no = ('help', 'Jishaku', 'Errors', 'Extra', 'rReactions',
                  'welcome')
            help_embed = qEmbed()
            help_embed.title = f'Command categories ({len(self.client.cogs) - len(no)})'
            help_embed_desc = ''
            cogs = []
            for cog in self.client.cogs:
                if cog not in no:
                    cogs.append(cog)
            fields1 = []
            for cog in cogs:
                cog1 = self.client.get_cog(cog)
                mylist = []
                for item in cog1.walk_commands():
                    if not isinstance(item, commands.Group):
                        parent = item.parent
                        if not parent:
                            mylist.append(item.name)
                        if parent:
                            mylist.append(f"{parent.name} {item.name}")
                fields1.append({
                    "name": f"{cog1.qualified_name.title()}",
                    "value": ', '.join(f'`.{x}`' for x in mylist),
                    "inline": False
                })
                help_embed.add_field(name=f'{cog1.qualified_name.title()}',
                                     value=', '.join(f'`.{x}`'
                                                     for x in mylist),
                                     inline=False)
            return await PagePicker(
                list=fields1,
                client=self.client,
                timeout=200,
                title=f'Robo-ArtiFeZ Help',
                ctx=ctx,
                color=main_color,
                footer='Robo-ArtiFeZ・Developed with 💖 by Team ArtiFeZ!'
            ).pick()