Catch cannot paginate errors
This commit is contained in:
parent
6d65710cfe
commit
7ce7d66c48
30
cogs/misc.py
30
cogs/misc.py
|
@ -53,21 +53,25 @@ class Miscellaneous(commands.Cog):
|
||||||
@utils.can_run(send_messages=True)
|
@utils.can_run(send_messages=True)
|
||||||
async def help(self, ctx, *, command: str = None):
|
async def help(self, ctx, *, command: str = None):
|
||||||
"""Shows help about a command or the bot"""
|
"""Shows help about a command or the bot"""
|
||||||
|
try:
|
||||||
if command is None:
|
if command is None:
|
||||||
p = await utils.HelpPaginator.from_bot(ctx)
|
p = await utils.HelpPaginator.from_bot(ctx)
|
||||||
else:
|
|
||||||
entity = ctx.bot.get_cog(command) or ctx.bot.get_command(command)
|
|
||||||
|
|
||||||
if entity is None:
|
|
||||||
clean = command.replace("@", "@\u200b")
|
|
||||||
return await ctx.send(f'Command or category "{clean}" not found.')
|
|
||||||
elif isinstance(entity, commands.Command):
|
|
||||||
p = await utils.HelpPaginator.from_command(ctx, entity)
|
|
||||||
else:
|
else:
|
||||||
p = await utils.HelpPaginator.from_cog(ctx, entity)
|
entity = ctx.bot.get_cog(command) or ctx.bot.get_command(command)
|
||||||
|
|
||||||
await p.paginate()
|
if entity is None:
|
||||||
|
clean = command.replace("@", "@\u200b")
|
||||||
|
return await ctx.send(f'Command or category "{clean}" not found.')
|
||||||
|
elif isinstance(entity, commands.Command):
|
||||||
|
p = await utils.HelpPaginator.from_command(ctx, entity)
|
||||||
|
else:
|
||||||
|
p = await utils.HelpPaginator.from_cog(ctx, entity)
|
||||||
|
|
||||||
|
await p.paginate()
|
||||||
|
except utils.CannotPaginate:
|
||||||
|
await ctx.send(
|
||||||
|
"I need embed links permissions in order to do this command :("
|
||||||
|
)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@utils.can_run(send_messages=True)
|
@utils.can_run(send_messages=True)
|
||||||
|
|
Loading…
Reference in a new issue