[commands] Make the CommandError required argument optional again.

This commit is contained in:
Rapptz 2016-06-10 23:42:21 -04:00
parent a175c86aa1
commit 5f9ed8c9d2

View File

@ -39,10 +39,13 @@ class CommandError(DiscordException):
in a special way as they are caught and passed into a special event in a special way as they are caught and passed into a special event
from :class:`Bot`\, :func:`on_command_error`. from :class:`Bot`\, :func:`on_command_error`.
""" """
def __init__(self, message): def __init__(self, message=None, *args):
# clean-up @everyone and @here mentions if message is not None:
m = message.replace('@everyone', '@\u200beveryone').replace('@here', '@\u200bhere') # clean-up @everyone and @here mentions
super().__init__(m) m = message.replace('@everyone', '@\u200beveryone').replace('@here', '@\u200bhere')
super().__init__(m, *args)
else:
super().__init__(*args)
class CommandNotFound(CommandError): class CommandNotFound(CommandError):
"""Exception raised when a command is attempted to be invoked """Exception raised when a command is attempted to be invoked