[commands] Add discord.Guild converter and GuildNotFound error
* Add discord.Guild converter and GuildNotFound error * note for lack of disambiguation in Guilds with duplicate names, and removed the possibility of returning None * edited converter to use `utils.get` over `utils.find` and docs edited with Converter and Exception.
This commit is contained in:
@ -45,6 +45,7 @@ __all__ = (
|
||||
'NotOwner',
|
||||
'MessageNotFound',
|
||||
'MemberNotFound',
|
||||
'GuildNotFound',
|
||||
'UserNotFound',
|
||||
'ChannelNotFound',
|
||||
'ChannelNotReadable',
|
||||
@ -230,6 +231,22 @@ class MemberNotFound(BadArgument):
|
||||
self.argument = argument
|
||||
super().__init__('Member "{}" not found.'.format(argument))
|
||||
|
||||
class GuildNotFound(BadArgument):
|
||||
"""Exception raised when the guild provided was not found in the bot's cache.
|
||||
|
||||
This inherits from :exc:`BadArgument`
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
argument: :class:`str`
|
||||
The guild supplied by the called that was not found
|
||||
"""
|
||||
def __init__(self, argument):
|
||||
self.argument = argument
|
||||
super().__init__('Guild "{}" not found.'.format(argument))
|
||||
|
||||
class UserNotFound(BadArgument):
|
||||
"""Exception raised when the user provided was not found in the bot's
|
||||
cache.
|
||||
|
Reference in New Issue
Block a user