Add datetime converter and util #54

Open
Daggy1234 wants to merge 3 commits from Daggy1234/patch-1 into 2.0
Showing only changes of commit db10f65393 - Show all commits

View File

@ -98,6 +98,7 @@ __all__ = (
'MissingFlagArgument',
'TooManyFlags',
'MissingRequiredFlag',
'FormattedDatetimeConversionFailure',
)
class CommandError(DiscordException):
@ -995,3 +996,16 @@ class MissingFlagArgument(FlagError):
def __init__(self, flag: Flag) -> None:
self.flag: Flag = flag
super().__init__(f'Flag {flag.name!r} does not have an argument')
class FormattedDatetimeConversionFailure(BadArgument):
"""Exception raised when the timestamp provided does not match the correct
format.
This inherits from :exc:`BadArgument`
Attributes
-----------
argument: :class:`str`
The emoji supplied by the caller that did not match the regex
"""
def __init__(self, argument):
self.argument = argument
super().__init__(f'Timestamp "{argument}" wasn\'t formatted correctly.')