This commit is contained in:
iDutchy
2020-10-17 18:42:19 -05:00
parent a09e096d42
commit d75cd66b90
14 changed files with 128 additions and 5 deletions

View File

@ -206,6 +206,9 @@ class GuildChannel:
def __str__(self):
return self.name
def __int__(self):
return self.id
@property
def _sorting_bucket(self):
raise NotImplementedError

View File

@ -239,7 +239,7 @@ class Client:
self._listeners = {}
self.shard_id = options.get('shard_id')
self.shard_count = options.get('shard_count')
colour = options.get('embed_color')
colour = options.get('embed_color', Color.default())
if isinstance(colour, (Color, Colour)):
os.environ['DEFAULT_EMBED_COLOR'] = str(hex(colour))
else:

View File

@ -112,6 +112,9 @@ class Emoji(_EmojiTag):
return '<a:{0.name}:{0.id}>'.format(self)
return "<:{0.name}:{0.id}>".format(self)
def __int__(self):
return self.id
def __repr__(self):
return '<Emoji id={0.id} name={0.name!r} animated={0.animated} managed={0.managed}>'.format(self)

View File

@ -207,6 +207,9 @@ class Guild(Hashable):
def __str__(self):
return self.name
def __int__(self):
return self.id
def __repr__(self):
attrs = (
'id', 'name', 'shard_id', 'chunked'

View File

@ -84,6 +84,9 @@ class Attachment:
""":class:`bool`: Whether this attachment contains a spoiler."""
return self.filename.startswith('SPOILER_')
def __int__(self):
return self.id
def __repr__(self):
return '<Attachment id={0.id} filename={0.filename!r} url={0.url!r}>'.format(self)
@ -385,6 +388,12 @@ class Message:
except KeyError:
continue
def __str__(self):
return self.content
def __int__(self):
return self.id
def __repr__(self):
return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self)

View File

@ -99,6 +99,9 @@ class Role(Hashable):
def __str__(self):
return self.name
def __int__(self):
return self.id
def __repr__(self):
return '<Role id={0.id} name={0.name!r}>'.format(self)

View File

@ -92,6 +92,9 @@ class BaseUser(_BaseUser):
def __str__(self):
return '{0.name}#{0.discriminator}'.format(self)
def __int__(self):
return self.id
def __eq__(self, other):
return isinstance(other, _BaseUser) and other.id == self.id

View File

@ -533,6 +533,12 @@ def escape_mentions(text):
This does not include channel mentions.
.. note::
For more granular control over what mentions should be escaped
within messages, refer to the :class:`~discord.AllowedMentions`
class.
Parameters
-----------
text: :class:`str`