cogs/emoji: flesh out local_check and add on_command_error

This commit is contained in:
bmintz 2018-07-30 00:15:31 -05:00
parent c5152309a6
commit a94dcbb2b5
1 changed files with 18 additions and 3 deletions

View File

@ -31,10 +31,25 @@ class Emotes:
self.bot.config['user_agent'] + ' '
+ self.bot.http.user_agent
})
async def __local_check(self, context):
return (
context.guild
and context.author.guild_permissions.manage_emojis)
if not context.guild:
await context.send(
f'{utils.SUCCESS_EMOTES[False]} Sorry, this command may only be used in a server.')
return False
if not context.author.guild_permissions.manage_emojis:
await context.send(
f'{utils.SUCCESS_EMOTES[False]} '
"Sorry, you don't have enough permissions to run this command. "
'You need the Manage Emojis permission.')
return False
return True
async def on_command_error(self, context, error):
if isinstance(error, errors.EmoteManagerError):
await context.send(str(error))
@commands.command()
async def add(self, context, *args):