async def invoke(self, ctx):
if ctx.command is not None:<EOL><INDENT>self.dispatch('<STR_LIT>', ctx)<EOL>try:<EOL><INDENT>if await self.can_run(ctx, call_once=True):<EOL><INDENT>await ctx.command.invoke(ctx)<EOL><DEDENT><DEDENT>except errors.CommandError as exc:<EOL><INDENT>await ctx.command.dispatch_error(ctx, exc)<EOL><DEDENT>else:<EOL><INDENT>self.dispatch('<STR_LIT>', ctx)<EOL><DEDENT><DEDENT>elif ctx.invoked_with:<EOL><INDENT>exc = errors.CommandNotFound('<STR_LIT>'.format(ctx.invoked_with))<EOL>self.dispatch('<STR_LIT>', ctx, exc)<EOL><DEDENT>
|coro|

        Invokes the command given under the invocation context and
        handles all the internal event dispatch mechanisms.

        Parameters
        -----------
        ctx: :class:`.Context`
            The invocation context to invoke.