1
0
Fork 0
mirror of synced 2024-06-01 18:29:38 +12:00

Added an exception catch for when permissions aren't given to the bot for pagination

This commit is contained in:
Phxntxm 2017-02-12 17:36:11 -06:00
parent 84acd50042
commit f9ce8ef85e
5 changed files with 15 additions and 6 deletions

View file

@ -77,7 +77,10 @@ class Core:
if cmd is None:
entries = sorted(utils.get_all_commands(self.bot))
pages = utils.Pages(self.bot, message=ctx.message, entries=entries)
await pages.paginate()
try:
await pages.paginate()
except utils.CannotPaginate as e:
await self.bot.say(str(e))
else:
# Get the description for a command
description = cmd.help

View file

@ -450,7 +450,10 @@ class Mod:
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)
await pages.paginate()
try:
await pages.paginate()
except utils.CannotPaginate as e:
await self.bot.say(str(e))
else:
try:
fmt = rules[rule - 1]

View file

@ -167,13 +167,13 @@ class Music:
state.voice = await self.bot.join_voice_channel(channel)
if state.voice:
return True
except (discord.ClientException, socket.gaierror):
except (discord.ClientException, socket.gaierror, ConnectionResetError):
continue
return False
async def remove_voice_client(self, server):
async def remove_voice_client(self, server):greendsi_webimsuan
"""Removes any voice clients from a server
This is sometimes needed, due to the unreliability of Discord's voice connection
We do not want to end up with a voice client stuck somewhere, so this cancels any found for a server"""

View file

@ -239,7 +239,10 @@ class Stats:
output.append("{} (Rating: {})".format(member.display_name, rating))
pages = utils.Pages(self.bot, message=ctx.message, entries=output, per_page=10)
await pages.paginate()
try:
await pages.paginate()
except utils.CannotPaginate as e:
await self.bot.say(str(e))
@commands.command(pass_context=True, no_pm=True)
@utils.custom_perms(send_messages=True)

View file

@ -3,4 +3,4 @@ from .checks import is_owner, custom_perms, is_pm
from .config import *
from .utilities import *
from .images import create_banner
from .paginator import Pages
from .paginator import Pages, CannotPaginate