[commands] Add a converter for discord.Object

This commit is contained in:
Nadir Chowdhury
2021-04-16 13:18:57 +01:00
committed by GitHub
parent a30ec197c2
commit 5dec62f4c0
4 changed files with 49 additions and 0 deletions

View File

@@ -42,6 +42,7 @@ __all__ = (
'MaxConcurrencyReached',
'NotOwner',
'MessageNotFound',
'ObjectNotFound',
'MemberNotFound',
'GuildNotFound',
'UserNotFound',
@@ -213,6 +214,23 @@ class NotOwner(CheckFailure):
"""
pass
class ObjectNotFound(BadArgument):
"""Exception raised when the argument provided did not match the format
of an ID or a mention.
This inherits from :exc:`BadArgument`
.. versionadded:: 2.0
Attributes
-----------
argument: :class:`str`
The argument supplied by the caller that was not matched
"""
def __init__(self, argument):
self.argument = argument
super().__init__(f'{argument!r} does not follow a valid ID or mention format.')
class MemberNotFound(BadArgument):
"""Exception raised when the member provided was not found in the bot's
cache.