1
0
Fork 0
mirror of synced 2024-06-10 14:44:32 +12:00

Catch exception when we cannot paginate

This commit is contained in:
Phxntxm 2017-02-12 17:58:27 -06:00
parent 04c07fc08c
commit e45f787077
3 changed files with 4 additions and 11 deletions

View file

@ -58,13 +58,6 @@ class Core:
cmd = None
page = 1
if ctx.message.server:
perms = ctx.message.server.me.permissions_in(ctx.message.channel)
if not (perms.embed_links and perms.add_reactions):
fmt = "I need the permissions `embed_links` and `add_reactions` to send my help message! " \
" Otherwise you can use this link to view available commands {}".format(
"http://bonfirebot.readthedocs.io/en/latest/")
await self.bot.say(fmt)
if message is not None:
# If something is provided, it can either be the page number or a command
@ -76,8 +69,8 @@ class Core:
if cmd is None:
entries = sorted(utils.get_all_commands(self.bot))
pages = utils.Pages(self.bot, message=ctx.message, entries=entries)
try:
pages = utils.Pages(self.bot, message=ctx.message, entries=entries)
await pages.paginate()
except utils.CannotPaginate as e:
await self.bot.say(str(e))

View file

@ -448,9 +448,9 @@ class Mod:
return
if rule is None:
pages = utils.Pages(self.bot, message=ctx.message, entries=rules, per_page=5)
pages.title = "Rules for {}".format(ctx.message.server.name)
try:
pages = utils.Pages(self.bot, message=ctx.message, entries=rules, per_page=5)
pages.title = "Rules for {}".format(ctx.message.server.name)
await pages.paginate()
except utils.CannotPaginate as e:
await self.bot.say(str(e))

View file

@ -238,8 +238,8 @@ class Stats:
member = ctx.message.server.get_member(member_id)
output.append("{} (Rating: {})".format(member.display_name, rating))
pages = utils.Pages(self.bot, message=ctx.message, entries=output, per_page=10)
try:
pages = utils.Pages(self.bot, message=ctx.message, entries=output)
await pages.paginate()
except utils.CannotPaginate as e:
await self.bot.say(str(e))