async def on_message(self, message):
     self.bot.deleted_message_cache[message.id] = message
     if message.content == "<@!787927476177076234>" and not message.author.bot:
         message_ = await message.channel.send(
             "Hii there why u ping me smh oh i mean hii my prefix is `ovo ` "
         )
         self.bot._message_cache[message.id] = message_
     if message.content.startswith(";;") and not message.author.bot:
         lists = []
         msg = message.content.replace(" ", "")
         emojis = msg.split(";;")
         for i in emojis:
             if i == "":
                 continue
             e = finder(i,
                        self.bot.emojis,
                        key=lambda i: i.name,
                        lazy=False)
             if e == []:
                 continue
             e = e[0]
             if e is None or emojis == []:
                 continue
             if e.is_usable() != False:
                 lists.append(str(e))
         if lists != []:
             try:
                 message_ = await message.channel.send("".join(lists))
                 self.bot._message_cache[message.id] = message_
             except:
                 pass
Exemple #2
0
    async def javadocs(self, ctx, query: str = None):
        e = discord.Embed(colour=discord.Color.blurple())
        e.set_author(name=f'Query made by: {ctx.author}',
                     icon_url=ctx.author.avatar_url)

        if not query:
            e.description = '[JavaDocs](https://www.chattriggers.com/javadocs/)'
            return await ctx.send(embed=e)

        e.title = f'Results for: `{query}`'
        e.description = ''

        for kotlin_class in self.bot._cache:
            print([kotlin_class] + [method for method in kotlin_class.methods])
            results = finder(query, [kotlin_class] + [method for method in kotlin_class.methods])

            for obj in results:
                if isinstance(obj, KotlinClass):
                    e.description += f'[`{obj.clean_name}`]({obj.url})\n'

                elif isinstance(obj, KotlinMethod):
                    e.description += f'[`{obj.kotlin_class.clean_name}.{obj.name}{obj.parameters}`]({obj.url})\n'

        if not e.description:
            e.description = 'None Found!'

        await ctx.send(embed=e)
Exemple #3
0
 async def emoji(self, ctx, *, search: str = None):
     lists = []
     paginator = WrappedPaginator(max_size=500, prefix="", suffix="")
     if search != None:
         emojis = finder(search,
                         self.bot.emojis,
                         key=lambda i: i.name,
                         lazy=False)
         if emojis == []:
             return await ctx.send("no emoji found")
         for i in emojis:
             if i.animated == True:
                 lists.append(f"{str(i)} `<a:{i.name}:{i.id}>`")
             else:
                 lists.append(f"{str(i)} `<:{i.name}:{i.id}>`")
         paginator.add_line("\n".join(lists))
         interface = PaginatorInterface(ctx.bot,
                                        paginator,
                                        owner=ctx.author)
         return await interface.send_to(ctx)
     for i in self.bot.emojis:
         if i.animated == True:
             lists.append(f"{str(i)} `<a:{i.name}:{i.id}>`")
         else:
             lists.append(f"{str(i)} `<:{i.name}:{i.id}>`")
     paginator.add_line("\n".join(lists))
     interface = PaginatorInterface(ctx.bot, paginator, owner=ctx.author)
     await interface.send_to(ctx)
    async def do_docs(self, ctx, key, obj):
        page_types = {
            "python": "https://docs.python.org/3",
            "nextcord": "https://docs.nextcord.dev/en/stable",
            "nextcord_latest": "https://docs.nextcord.dev/en/latest",
            "menus": "https://menus.docs.nextcord.dev/en/latest",
            "ipc": "https://ipc.docs.nextcord.dev/en/latest",
            "dpy": "https://discordpy.readthedocs.io/en/stable",
            "dpy2": "https://discordpy.readthedocs.io/en/latest",
            "pycord": "https://docs.pycord.dev/en/master",
            "edpy": "https://enhanced-dpy.readthedocs.io/en/latest",
            "disnake": "https://disnake.readthedocs.io/en/latest",
        }

        if obj is None:
            await ctx.send(page_types[key])
            return

        if not hasattr(self, "_docs_cache"):
            await ctx.trigger_typing()
            await self.build_docs_lookup_table(page_types)

        obj = re.sub(r"^(?:discord\.(?:ext\.)?)?(?:commands\.)?(.+)", r"\1",
                     obj)
        obj = re.sub(r"^(?:nextcord\.(?:ext\.)?)?(?:commands\.)?(.+)", r"\1",
                     obj)

        if key.startswith("master"):
            # point the abc.Messageable types properly:
            q = obj.lower()
            for name in dir(discord.abc.Messageable):
                if name[0] == "_":
                    continue
                if q == name:
                    obj = f"abc.Messageable.{name}"
                    break

        cache = list(self._docs_cache[key].items())

        matches = fuzzy.finder(obj, cache, key=lambda t: t[0],
                               lazy=False)[:8]  # type: ignore

        e = discord.Embed(colour=discord.Colour.blurple())
        if len(matches) == 0:
            return await ctx.send("Could not find anything. Sorry.")

        e.description = "\n".join(f"[`{key}`]({url})" for key, url in matches)
        ref = ctx.message.reference
        refer = None
        if ref and isinstance(ref.resolved, discord.Message):
            refer = ref.resolved.to_reference()
        await ctx.send(embed=e, reference=refer)
Exemple #5
0
 async def emojis(self, ctx, search=None):
     emojis = []
     if search:
         result = finder(text=search, collection=self.bot.emojis, key=lambda emoji: emoji.name, lazy=False)
         if result == []:
             return await ctx.send("Nothing found for your query.")
         for emoji in result:
             emojis.append(f"{str(emoji)} `{emoji.name}`")
         paginator = WrappedPaginator(prefix='', suffix='', max_size=500)
     else:
         for emoji in self.bot.emojis:
             emojis.append(f"{str(emoji)} `{emoji.name}`")
         paginator = WrappedPaginator(prefix='', suffix='', max_size=1000)
     paginator.add_line('\n'.join(emojis))
     interface = PaginatorInterface(ctx.bot, paginator, owner=ctx.author)
     await interface.send_to(ctx)
    async def uhh_rtfm_pls(self, ctx, key, obj):
        page_types = {
            'latest': 'https://discordpy.readthedocs.io/en/latest',
            'python': 'https://docs.python.org/3',
            'asyncpg': "https://magicstack.github.io/asyncpg/current/",
            "zaneapi": "https://docs.zaneapi.com/en/latest/",
            "aiohttp": "https://docs.aiohttp.org/en/stable/"
        }
        if obj is None:
            await ctx.send(page_types[key])
            return

        if not hasattr(self.bot, "_rtfm_cache"):
            await ctx.trigger_typing()
            await self.build_rtfm_lookup_table(page_types)

        obj = re.sub(r'^(?:discord\.(?:ext\.)?)?(?:commands\.)?(.+)', r'\1',
                     obj)

        if key.startswith('latest'):
            # point the abc.Messageable types properly:
            q = obj.lower()
            for name in dir(discord.abc.Messageable):
                if name[0] == '_':
                    continue
                if q == name:
                    obj = f'abc.Messageable.{name}'
                    break

        cache = list(self.bot._rtfm_cache[key].items())

        def transform(tup):
            return tup[0]

        matches = fuzzy.finder(obj, cache, key=lambda t: t[0], lazy=False)[:10]

        e = discord.Embed(colour=0x00ff6a)
        if len(matches) == 0:
            return await ctx.send("Can't find anything")
        # paginator = commands.Paginator(prefix="", suffix="", max_size=1980)
        # for i,v in matches:
        #     paginator.add_line(f'[{i}]({v})')

        # interface = PaginatorEmbedInterface(ctx.bot, paginator, owner=ctx.author)
        # await interface.send_to(ctx)
        e.description = '\n'.join(f'[{key}]({url})' for key, url in matches)
        await ctx.send(embed=e, reference=ctx.replied_reference)
Exemple #7
0
    async def do_rtfm(self, ctx: Context, key: str,
                      obj: Optional[str]) -> None:
        page_types = {
            "discord.py": "https://discordpy.readthedocs.io/en/latest",
            "discord.py-master": "https://discordpy.readthedocs.io/en/master",
            "python": "https://docs.python.org/3",
            "python-jp": "https://docs.python.org/ja/3",
            "asyncpg": "https://magicstack.github.io/asyncpg/current",
            "aiohttp": "https://docs.aiohttp.org/en/stable",
            "hondana": "https://hondana.readthedocs.io/en/stable",
            "hondana-m": "https://hondana.readthedocs.io/en/latest",
        }

        if obj is None:
            await ctx.send(page_types[key])
            return

        if not hasattr(self, "_rtfm_cache"):
            await ctx.trigger_typing()
            await self.build_rtfm_lookup_table(page_types)

        obj = re.sub(r"^(?:discord\.(?:ext\.)?)?(?:commands\.)?(.+)", r"\1",
                     obj)

        if key.startswith("discord."):
            # point the abc.Messageable types properly:
            q = obj.lower()
            for name in dir(discord.abc.Messageable):
                if name[0] == "_":
                    continue
                if q == name:
                    obj = f"abc.Messageable.{name}"
                    break

        cache = list(self._rtfm_cache[key].items())

        matches = fuzzy.finder(obj, cache, key=lambda t: t[0], lazy=False)

        e = discord.Embed(colour=self.bot.colour)
        if not matches:
            await ctx.send("Could not find anything. Sorry.")
            return
        e.title = f"RTFM for __**`{key}`**__: {obj}"
        e.description = "\n".join(f"[`{key}`]({url})"
                                  for key, url in matches[:8])  # type: ignore
        e.set_footer(text=f"{len(matches)} possible results.")  # type: ignore
        await ctx.send(embed=e)
Exemple #8
0
    async def mappings(self, ctx, query: str):
        e = discord.Embed(colour=discord.Color.blurple())
        e.set_author(name=f'Query made by: {ctx.author}',
                     icon_url=ctx.author.avatar_url)

        if not query:
            e.description = '[JavaDocs](https://www.chattriggers.com/javadocs/)'
            return await ctx.send(embed=e)

        e.title = f'Results for: `{query}`'
        e.description = ''
        counter = 0

        for mc_class in self.bot.mapping_viewer.mappings:
            results = finder(query, [mc_class] + [method for method in mc_class.methods] +
                             [method for method in mc_class.fields])

            if counter > 5:
                break

            for obj in results:
                if counter > 5:
                    break

                if isinstance(obj, MCObfuscatedClass):
                    e.description += f'`{obj.package.replace("/", ".")}{obj.name}`\n'
                    counter += 1

                elif isinstance(obj, MCObfuscatedMethod):
                    e.description += f'`{obj.mc_class.package.replace("/", ".")}' \
                                     f'{obj.mc_class.name}.{obj.obfuscated_name}() | ' \
                                     f'{obj.mc_class.package.replace("/", ".")}' \
                                     f'{obj.mc_class.name}.{obj.deobfuscated_name}()`\n'
                    counter += 1

                elif isinstance(obj, MCObfuscatedField):
                    e.description += f'`{obj.mc_class.package.replace("/", ".")}' \
                                     f'{obj.mc_class.name}.{obj.obfuscated_name} | ' \
                                     f'{obj.mc_class.package.replace("/", ".")}' \
                                     f'{obj.mc_class.name}.{obj.deobfuscated_name}`\n'
                    counter += 1

        if not e.description:
            e.description = 'None Found!'

        await ctx.send(embed=e)
Exemple #9
0
    async def on_message(self, message):
        not_owner = not await self.bot.is_owner(message.author)
        if not_owner or message.author.bot:
            return

        matches = self.match.findall(message.content)
        if not matches:
            return
        emoji = []
        for match in matches:
            e = finder(match, self.bot.emojis, key=lambda emoji: emoji.name, lazy=False)
            if e == []:
                continue
            e = e[0]
            if e is None:
                return
            if e.is_usable() != False:
                emoji.append(str(e))
        await message.channel.send(" ".join(emoji))
Exemple #10
0
    async def do_rtfm(self, ctx: commands.Context, query: Optional[str],
                      key: str) -> None:
        pages = {
            'latest': 'https://discordpy.readthedocs.io/en/latest',
            'python': 'https://docs.python.org/3'
        }

        if not query:
            return await ctx.send(pages[key])

        if not hasattr(self, '_rtfm_cache'):
            await ctx.trigger_typing()
            await self.build_rtfm(pages)

        query = re.sub(r'^(?:discord\.(?:ext\.)?)?(?:commands\.)?(.+)', r'\1',
                       query)

        if key.startswith('latest'):
            obj = query.lower()
            for name in dir(discord.abc.Messageable):
                if name[0] == '_':
                    continue

                if obj == name:
                    query = f'abc.Messageable.{name}'
                    break

        cache = list(self._rtfm_cache[key].items())
        matches = fuzzy.finder(query,
                               cache,
                               key=lambda item: item[0],
                               lazy=False)[:8]

        if len(matches) == 0:
            return await ctx.send('Nada encontrado, você digitou corretamente?'
                                  )

        content = '\n'.join(f'[`{key}`]({url})' for key, url in matches)
        await ctx.send(content)
    async def on_command_error(self, ctx, error):

        global match
        if hasattr(ctx.command, 'on_error'):
            return

        cog = ctx.cog
        if cog and cog._get_overridden_method(cog.cog_command_error) is not None:
            return

        ignored = ()

        error = getattr(error, 'original', error)

        if isinstance(error, ignored):
            return

        if isinstance(error, commands.CommandNotFound):
            failed_command = re.match(rf"^({ctx.prefix})\s*(.*)", ctx.message.content, flags=re.IGNORECASE).group(2)

            matches = finder(failed_command, self.bot.command_list, lazy=False)
            if not matches:
                return

            match = None

            for command in matches:
                cmd = self.bot.get_command(command)
                if not await cmd.can_run(ctx):
                    return
                match = command
                break

            return await qembed(ctx, f"No command called `{ctx.invoked_with}` found. Did you mean `{match}`?")

        elif isinstance(error, commands.CheckFailure):
            return await qembed(
                ctx,
                f'You do not have the correct permissions for `{ctx.invoked_with}`')

        if isinstance(error, discord.Forbidden):
            return await qembed(
                ctx,
                f'I do not have the correct permissions for `{ctx.command}`')

        elif isinstance(error, commands.CommandOnCooldown):
            retry_after = humanize.precisedelta(error.retry_after, minimum_unit='seconds')
            return await qembed(ctx, f"This command is on cooldown.\nTry again in {retry_after}")

        elif isinstance(error, commands.NoPrivateMessage):
            try:
                e = discord.Embed(description=f'`{ctx.command}` can not be used in Private Messages.',color=self.bot.embed_color)
                return await ctx.author.send(embed=e)
            except discord.HTTPException:
                pass

        elif isinstance(error, commands.MissingRequiredArgument):
            return await qembed(ctx, f'{error}')

        elif isinstance(error, commands.DisabledCommand):
            return await qembed(ctx, f'`{ctx.command}` has been disabled.')

        elif isinstance(error, commands.BadArgument):

            print(f'Ignoring exception in command {ctx.invoked_with}:'file=sys.stderr)

            traceback.print_exception(type(error),
                                      error,
                                      error.__traceback__,
                                      file=sys.stderr)

            formatted = traceback.format_exception(type(error), error, error.__traceback__)
            await ctx.send(f"Something has gone wrong while executing `{ctx.invoked_with}`:\n"
                            f"```py\n{''.join(formatted)}\n```")
Exemple #12
0
    async def on_command_error(self, ctx, error):
        if isinstance(error, Maintenance):
            return await ctx.send(embed=ctx.embed(title='⚠️ Maintenence mode is active.'))

        if isinstance(error, Blacklisted):
            reason = self.bot.blacklist.get(ctx.author.id, "No reason, you probably did something dumb.")
            return await ctx.author.send(embed=ctx.embed(title='⚠️ You are blacklisted.',
                                                  description=f'**Blacklisted For:** {reason}'
                                                              f'\n\nYou can join the support server [here]({self.bot.support_invite}) if you feel this is a mistake.'))

        command = ctx.invoked_with

        # This prevents any commands with local handlers being handled here in on_command_error.
        global match
        if hasattr(ctx.command, 'on_error'):
            return

        # This prevents any cogs with an overwritten cog_command_error being handled here.
        cog = ctx.cog
        if cog and cog._get_overridden_method(cog.cog_command_error) is not None:
            return

        # ignored = (commands.CommandNotFound,)  # if you want to not send error messages
        ignored = ()

        # Allows us to check for original exceptions raised and sent to CommandInvokeError.
        # If nothing is found. We keep the exception passed to on_command_error.
        error = getattr(error, 'original', error)

        # Anything in ignored will return and prevent anything happening.
        if isinstance(error, ignored):
            return

        if isinstance(error, commands.CommandNotFound):
            failed_command = re.match(rf"^({ctx.prefix})\s*(.*)", ctx.message.content, flags=re.IGNORECASE).group(2)
            matches = finder(failed_command, self.bot.command_list, lazy=False)
            if not matches:
                return
            match = None
            for command in matches:
                cmd = self.bot.get_command(command)
                if not await cmd.can_run(ctx):
                    return
                match = command
                break
            return await ctx.send(embed=ctx.embed(
                description=f"No command called `{failed_command}` found. Did you mean `{match}`?"
            ))

        if isinstance(error, commands.CheckFailure):
            return await ctx.send(embed=ctx.embed(
                description=f'You do not have the correct permissions for `{command}`'
            ))

        if isinstance(error, discord.Forbidden):
            return await ctx.send(embed=ctx.embed(
                description=f'I do not have the correct permissions for `{command}`'
            ))

        if isinstance(error, commands.CommandOnCooldown):
            retry = humanize.precisedelta(error.retry_after, minimum_unit='seconds')
            return await ctx.send(embed=ctx.embed(
                description=f"{command} is on cooldown.\nTry again in {retry}"
            ))

        if isinstance(error, commands.NoPrivateMessage):
            try:
                return await ctx.author.send(embed=ctx.embed(description=f"{ctx.invoked_with} cannot be used in DM's"))
            except discord.HTTPException:
                pass

        if isinstance(error, commands.MissingRequiredArgument):
            errors = str(error).split(" ", maxsplit=1)
            return await ctx.send(embed=ctx.embed(
                description=f'`{errors[0]}` {errors[1]}\n'
                            f'You can view the help for this command with `{ctx.clean_prefix}help` `{command}`'
            ))

        if isinstance(error, commands.DisabledCommand):
            return await ctx.send(embed=ctx.embed(description=f'`{command}` has been disabled.'))

        if isinstance(error, commands.BadArgument):
            return await ctx.send(embed=ctx.embed(title=str(error),
                                                  description=f'You provided a bad argument to `{command}`! View `{ctx.clean_prefix}help {command}` for more info on how to use this command.'))

        print('Ignoring exception in command {}:'.format(ctx.command), file=sys.stderr)
        traceback.print_exception(type(error),
                                  error,
                                  error.__traceback__,
                                  file=sys.stderr)

        formatted = traceback.format_exception(type(error), error, error.__traceback__)
        pretty_traceback = "".join(
            prettify_exceptions.DefaultFormatter().format_exception(type(error), error, error.__traceback__)
        )
        log_channel = await self.bot.fetch_channel(817433615473311744)
        webhook = await log_channel.webhooks()
        msg = (
            f"Command: {ctx.invoked_with}\n"
            f"Full content: {ctx.escape(ctx.message.content)}\n"
            f"Guild: {ctx.guild.name} ({ctx.guild.id})\n"
            f"Channel: {ctx.channel.name} ({ctx.channel.id})\n"
            f"User: {ctx.author.name} ({ctx.author.id})\n"
            f"Jump URL: {ctx.message.jump_url}"
        )
        embed = ctx.embed(title='AN ERROR OCCURED', url=await ctx.mystbin(pretty_traceback) + '.py',
                          description=f"```yaml\n{msg}```")
        await webhook[0].send(f"```py\n{''.join(formatted)}```", embed=embed)

        error = "".join(formatted)
        if len(error) > 1700:
            error = await ctx.mystbin(str(error)) + ".py"

        await ctx.send(
            f"Something has gone wrong while executing `{command}`. You should not be seeing this, I have contacted my developer with information about this error.\n"
            f"```py\n{error}\n```")
Exemple #13
0
    async def on_command_error(self, ctx, error):

        # This prevents any commands with local handlers being handled here in on_command_error.
        global match
        if hasattr(ctx.command, 'on_error'):
            return

        # This prevents any cogs with an overwritten cog_command_error being handled here.
        cog = ctx.cog
        if cog and cog._get_overridden_method(
                cog.cog_command_error) is not None:
            return

        # ignored = (commands.CommandNotFound,)  # if you want to not send error messages
        ignored = ()

        # Allows us to check for original exceptions raised and sent to CommandInvokeError.
        # If nothing is found. We keep the exception passed to on_command_error.
        error = getattr(error, 'original', error)

        # Anything in ignored will return and prevent anything happening.
        if isinstance(error, ignored):
            return

        if isinstance(error, commands.CommandNotFound):
            failed_command = re.match(rf"^({ctx.prefix})\s*(.*)",
                                      ctx.message.content,
                                      flags=re.IGNORECASE).group(2)
            matches = finder(failed_command, self.bot.command_list, lazy=False)
            if not matches:
                return
            match = None
            for command in matches:
                cmd = self.bot.get_command(command)
                if not await cmd.can_run(ctx):
                    return
                match = command
                break
            return await qembed(
                ctx,
                f"No command called `{ctx.invoked_with}` found. Did you mean `{match}`?"
            )

        elif isinstance(error, commands.CheckFailure):
            return await qembed(
                ctx,
                f'You do not have the correct permissions for `{ctx.invoked_with}`'
            )

        if isinstance(error, discord.Forbidden):
            return await qembed(
                ctx,
                f'I do not have the correct permissions for `{ctx.command}`')

        elif isinstance(error, commands.CommandOnCooldown):
            return await qembed(
                ctx,
                f"This command is on cooldown.\nTry again in {humanize.precisedelta(error.retry_after, minimum_unit='seconds')}"
            )

        elif isinstance(error, commands.NoPrivateMessage):
            try:
                e = discord.Embed(
                    description=
                    f'`{ctx.command}` can not be used in Private Messages.',
                    color=self.bot.embed_color)
                return await ctx.author.send(embed=e)
            except discord.HTTPException:
                pass

        elif isinstance(error, commands.MissingRequiredArgument):
            return await qembed(
                ctx, f'{error}\n'
                f'You can view the help for this command with `{ctx.prefix}help {ctx.invoked_with}`'
            )

        elif isinstance(error, commands.DisabledCommand):
            return await qembed(ctx, f'`{ctx.command}` has been disabled.')

        # For this error example we check to see where it came from...
        elif isinstance(error, commands.BadArgument):
            if ctx.command.qualified_name == 'tag list':  # Check if the command being invoked is 'tag list'
                return await qembed(
                    ctx, 'I could not find that member. Please try again.')

        else:
            # All other Errors not returned come here. And we can just print the default TraceBack.
            print('Ignoring exception in command {}:'.format(ctx.command),
                  file=sys.stderr)
            traceback.print_exception(type(error),
                                      error,
                                      error.__traceback__,
                                      file=sys.stderr)
            formatted = traceback.format_exception(type(error), error,
                                                   error.__traceback__)
            await ctx.send(
                f"Something has gone wrong while executing `{ctx.invoked_with}`:\n"
                f"```py\n{''.join(formatted)}\n```")
Exemple #14
0
    async def on_command_error(self, ctx, error):

        command = ctx.invoked_with

        # This prevents any commands with local handlers being handled here in on_command_error.
        global match
        if hasattr(ctx.command, 'on_error'):
            return

        # This prevents any cogs with an overwritten cog_command_error being handled here.
        cog = ctx.cog
        if cog and cog._get_overridden_method(
                cog.cog_command_error) is not None:
            return

        # ignored = (commands.CommandNotFound,)  # if you want to not send error messages
        ignored = ()

        # Allows us to check for original exceptions raised and sent to CommandInvokeError.
        # If nothing is found. We keep the exception passed to on_command_error.
        error = getattr(error, 'original', error)

        # Anything in ignored will return and prevent anything happening.
        if isinstance(error, ignored):
            return

        if isinstance(error, commands.CommandNotFound):
            failed_command = re.match(rf"^({ctx.prefix})\s*(.*)",
                                      ctx.message.content,
                                      flags=re.IGNORECASE).group(2)
            matches = finder(failed_command, self.bot.command_list, lazy=False)
            if not matches:
                return
            match = None
            for command in matches:
                cmd = self.bot.get_command(command)
                if not await cmd.can_run(ctx):
                    return
                match = command
                break
            return await ctx.send(embed=ctx.embed(
                description=
                f"No command called `{command}` found. Did you mean `{match}`?"
            ))

        if isinstance(error, commands.CheckFailure):
            return await ctx.send(embed=ctx.embed(
                description=
                f'You do not have the correct permissions for `{command}`'))

        if isinstance(error, discord.Forbidden):
            return await ctx.send(embed=ctx.embed(
                description=
                f'I do not have the correct permissions for `{command}`'))

        if isinstance(error, commands.CommandOnCooldown):
            retry = humanize.precisedelta(error.retry_after,
                                          minimum_unit='seconds')
            return await ctx.send(embed=ctx.embed(
                description=f"{command} is on cooldown.\nTry again in {retry}")
                                  )

        if isinstance(error, commands.NoPrivateMessage):
            try:
                return await ctx.author.send(embed=ctx.embed(
                    description=f"{ctx.invoked_with} cannot be used in DM's"))
            except discord.HTTPException:
                pass

        if isinstance(error, commands.MissingRequiredArgument):
            errors = str(error).split(" ", maxsplit=1)
            return await ctx.send(embed=ctx.embed(
                description=f'`{errors[0]}` {errors[1]}\n'
                f'You can view the help for this command with `{ctx.prefix}help` `{command}`'
            ))

        if isinstance(error, commands.DisabledCommand):
            return await ctx.send(embed=ctx.embed(
                description=f'`{command}` has been disabled.'))

        print('Ignoring exception in command {}:'.format(ctx.command),
              file=sys.stderr)
        traceback.print_exception(type(error),
                                  error,
                                  error.__traceback__,
                                  file=sys.stderr)
        formatted = traceback.format_exception(type(error), error,
                                               error.__traceback__)
        await ctx.send(
            f"Something has gone wrong while executing `{command}`:\n"
            f"```py\n{''.join(formatted)}\n```")