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.')
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)
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)
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)
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)
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)
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)
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)
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)
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)
async def pr_error(self, ctx: Context, error: Exception): await error_messages.error_handler( ctx, error, description.get_command('private rooms'), '', '', True)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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'))