Ejemplo n.º 1
0
 async def welcome_dm_text_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the welcome channel command"""
     # Handle error messages
     await error_messages.error_handler(
         ctx, error, description.get_command('welcome dm'),
         'Welcome DM text',
         'Give a text that will be send to new members via DM.')
Ejemplo n.º 2
0
 async def roles_remove_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the roles remove command"""
     # Handle error messages
     await error_messages.error_handler(
         ctx, error, description.get_command('roles remove'), 'Type',
         'The type must be either *admin*, *moderator* or *supporter*.',
         True)
Ejemplo n.º 3
0
 async def reports_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the reports command"""
     if not mod.get_mod_log(ctx.guild):
         # Ignore if the log is not set up
         return
     await error_messages.error_handler(ctx, error,
                                        description.get_command('reports'),
                                        'Member', 'Cannot find the member.',
                                        True)
Ejemplo n.º 4
0
 async def unload_error(self, ctx, error):
     """Handles exceptions while running the unload command"""
     # No Permission error
     if isinstance(error, CheckFailure):
         return
     # Handles the error messages
     await error_messages.error_handler(ctx, error,
                                        description.get_command('unload'),
                                        'Extension',
                                        "Didn't find the extension", True)
Ejemplo n.º 5
0
 async def unmute_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the unmute command"""
     if error.args[0].endswith('is not muted'):
         # Member is not muted
         await util.delete_message(ctx.message)
         await error_messages.invalid_input_error(
             ctx, title='Member', description='The member is not muted.')
     else:
         await error_messages.error_handler(
             ctx, error, description.get_command('unmute'), 'Member',
             'Cannot find the member.', True)
Ejemplo n.º 6
0
 async def clear_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the clear command"""
     if error.args[
             0] == 'Command raised an exception: HTTPException: 400 Bad Request (error code: 50034): You can only bulk delete messages that are under 14 days old.':
         # Messages are to old to delete
         await error_messages.custom_error(
             ctx, 'Messages are to old',
             'I cannot delete messages that are more than 14 days old')
     else:
         await error_messages.error_handler(
             ctx, error, description.get_command('clear'), 'Amount',
             'The amount has to be a positive integer.', True)
Ejemplo n.º 7
0
 async def tempmute_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the tempmute command"""
     if error.args[0].endswith('moderators'):
         # Cannot mute moderators
         await util.delete_message(ctx.message)
         await error_messages.invalid_input_error(
             ctx, title='Member', description='Cannot ban moderators.')
     elif error.args[0].endswith('mute the bot'):
         # Cannot mute the bot
         await util.delete_message(ctx.message)
         await error_messages.invalid_input_error(ctx,
                                                  title='Member',
                                                  description='Nice try...')
     elif error.args[0].endswith('Invalid Duration'):
         # Invalid duration
         await error_messages.arguments_error(
             ctx, description.get_command('tempmute'))
     else:
         await error_messages.error_handler(
             ctx, error, description.get_command('tempmute'), 'Member',
             'Cannot find the member.', True)
Ejemplo n.º 8
0
 async def roles_add_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the roles add command"""
     # Handle error messages
     if error.args[0].endswith('add default role'):
         # Cannot add default role
         await util.delete_message(ctx.message)
         await error_messages.invalid_input_error(
             ctx, title='Role', description='Cannot add @everyone')
     else:
         await error_messages.error_handler(
             ctx, error, description.get_command('roles add'), 'Type',
             'The type must be either *admin*, *moderator* or *autorole*.',
             True)
Ejemplo n.º 9
0
 async def ban_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the ban command"""
     if error.args[0].endswith('moderators'):
         # Cannot ban moderators
         await util.delete_message(ctx.message)
         await error_messages.invalid_input_error(
             ctx, title='Member', description='Cannot ban moderators.')
     elif error.args[0].endswith('ban the bot'):
         # Cannot ban the bot
         await util.delete_message(ctx.message)
         await error_messages.invalid_input_error(ctx,
                                                  title='Member',
                                                  description='Nice try...')
     else:
         await error_messages.error_handler(
             ctx, error, description.get_command('ban'), 'Member',
             'I am missing permissions to do that.', True)
Ejemplo n.º 10
0
 async def report_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the repor command"""
     if not mod.get_mod_log(ctx.guild):
         # Ignore if the log is not set up
         return
     elif error.args[0].endswith('moderators'):
         # Cannot report moderators
         await util.delete_message(ctx.message)
         await error_messages.invalid_input_error(
             ctx, title='Member', description='Cannot report moderators.')
     elif error.args[0].endswith('report the bot'):
         # Cannot report the bot
         await util.delete_message(ctx.message)
         await error_messages.invalid_input_error(ctx,
                                                  title='Member',
                                                  description='Nice try...')
     else:
         await error_messages.error_handler(
             ctx, error, description.get_command('report'), 'Member',
             'Cannot find the member.', True)
Ejemplo n.º 11
0
 async def pr_error(self, ctx: Context, error: Exception):
     await error_messages.error_handler(
         ctx, error, description.get_command('private rooms'), '', '', True)
Ejemplo n.º 12
0
 async def welcome_channel_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the welcome channel command"""
     # Handle the error messages
     await error_messages.error_handler(
         ctx, error, description.get_command('welcome channel'),
         'Welcome Channel', 'Cannot find the channel.', True)
Ejemplo n.º 13
0
 async def roles_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the roles command"""
     # Handles the error messages
     await error_messages.error_handler(ctx, error,
                                        description.get_command('roles'),
                                        'Roles', '', True)
Ejemplo n.º 14
0
 async def warns_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the warns command"""
     await error_messages.error_handler(ctx, error,
                                        description.get_command('warns'),
                                        'Member', 'Cannot find the member.',
                                        True)
Ejemplo n.º 15
0
 async def mod_log_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the moderation log command"""
     # Handle error messages
     await error_messages.error_handler(
         ctx, error, description.get_command('moderation log'), 'Channel',
         'Cannot find the channel.', True)
Ejemplo n.º 16
0
 async def moderation_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the moderation command"""
     # Handle the error messages
     await error_messages.error_handler(
         ctx, error, description.get_command('moderation'), 'Moderation',
         '', True)
Ejemplo n.º 17
0
 async def color_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the color command"""
     # Handles the error messages
     await error_messages.error_handler(
         ctx, error, description.get_command('color'), 'Color',
         'The color must be a HEX color code.', True)
Ejemplo n.º 18
0
 async def prefix_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the prefix command"""
     # Handles the error messages
     await error_messages.error_handler(
         ctx, error, description.get_command('prefix'), 'Prefix',
         'The prefix must be a single character.', True)
Ejemplo n.º 19
0
 async def setup_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the setup command"""
     await error_messages.error_handler(ctx, error,
                                        description.get_command('setup'),
                                        'Setup', '', True)
Ejemplo n.º 20
0
 async def welcome_error(self, ctx: Context, error: Exception):
     """Handles exceptions while running the welcome command"""
     # Handles the error messages
     await error_messages.error_handler(ctx, error,
                                        description.get_command('welcome'),
                                        'Welcome', '', True)
Ejemplo n.º 21
0
 async def private(self, ctx: Context):
     """Private group: Only for private rooms command"""
     if ctx.invoked_subcommand is None:
         # Send error message
         await error_messages.arguments_error(
             ctx, description.get_command('private rooms'))