[commands] Added dm_only check
Raises PrivateMessageOnly on failure.
This commit is contained in:
@ -28,15 +28,15 @@ from discord.errors import DiscordException
|
||||
|
||||
|
||||
__all__ = ['CommandError', 'MissingRequiredArgument', 'BadArgument',
|
||||
'NoPrivateMessage', 'CheckFailure', 'CommandNotFound',
|
||||
'DisabledCommand', 'CommandInvokeError', 'TooManyArguments',
|
||||
'UserInputError', 'CommandOnCooldown', 'NotOwner',
|
||||
'MissingPermissions', 'BotMissingPermissions', 'ConversionError',
|
||||
'BadUnionArgument', 'ArgumentParsingError',
|
||||
'PrivateMessageOnly', 'NoPrivateMessage', 'CheckFailure',
|
||||
'CommandNotFound' ,'DisabledCommand', 'CommandInvokeError',
|
||||
'TooManyArguments', 'UserInputError', 'CommandOnCooldown',
|
||||
'NotOwner', 'MissingPermissions', 'BotMissingPermissions',
|
||||
'ConversionError', 'BadUnionArgument', 'ArgumentParsingError',
|
||||
'UnexpectedQuoteError', 'InvalidEndOfQuotedStringError',
|
||||
'ExpectedClosingQuoteError', 'ExtensionError', 'ExtensionAlreadyLoaded',
|
||||
'ExtensionNotLoaded', 'NoEntryPointError', 'ExtensionFailed',
|
||||
'ExtensionNotFound' ]
|
||||
'ExtensionNotFound']
|
||||
|
||||
class CommandError(DiscordException):
|
||||
r"""The base exception type for all command related errors.
|
||||
@ -118,6 +118,12 @@ class CheckFailure(CommandError):
|
||||
"""Exception raised when the predicates in :attr:`.Command.checks` have failed."""
|
||||
pass
|
||||
|
||||
class PrivateMessageOnly(CheckFailure):
|
||||
"""Exception raised when an operation does not work outside of private
|
||||
message contexts.
|
||||
"""
|
||||
pass
|
||||
|
||||
class NoPrivateMessage(CheckFailure):
|
||||
"""Exception raised when an operation does not work in private message
|
||||
contexts.
|
||||
|
Reference in New Issue
Block a user