int() support
This commit is contained in:
parent
24839be99d
commit
09168d880f
@ -20,11 +20,13 @@ Custom Features
|
|||||||
- ``Guild.icon_url`` and ``User.avatar_url`` return the string in stead of Asset. use icon/avatar url_as to get the Asset
|
- ``Guild.icon_url`` and ``User.avatar_url`` return the string in stead of Asset. use icon/avatar url_as to get the Asset
|
||||||
- Merged in ext-colors (https://github.com/MGardne8/DiscordPyColours)
|
- Merged in ext-colors (https://github.com/MGardne8/DiscordPyColours)
|
||||||
- Using Rapptz/discord.py/tree/neo-docs for documentation
|
- Using Rapptz/discord.py/tree/neo-docs for documentation
|
||||||
- Adding support for ``hex()`` to ``discord.Color``
|
- Added support for ``hex()`` to ``discord.Color``
|
||||||
- Added ``Client.embed_color`` / ``Bot.embed_color``
|
- Added ``Client.embed_color`` / ``Bot.embed_color``
|
||||||
- Added ``Client.set_embed_color`` / ``Bot.set_embed_color``
|
- Added ``Client.set_embed_color`` / ``Bot.set_embed_color``
|
||||||
- Added ``TextChannel.can_send``
|
- Added ``TextChannel.can_send``
|
||||||
- Added ``Intents.from_list``
|
- Added ``Intents.from_list``
|
||||||
|
- Added support for ``int()`` to ``discord.User``, ``discord.Member``, ``discord.Emoji``, ``discord.Role``, ``discord.Guild``, ``discord.Message``, ``discord.TextChannel``, ``discord.VoiceChannel``, ``discord.CategoryChannel``, ``discord.Attachment`` and ``discord.Message``. This will return their id
|
||||||
|
- Added support for ``str()`` to ``discord.Message``. This will return the message content
|
||||||
|
|
||||||
Key Features
|
Key Features
|
||||||
-------------
|
-------------
|
||||||
|
@ -206,6 +206,9 @@ class GuildChannel:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _sorting_bucket(self):
|
def _sorting_bucket(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -112,6 +112,9 @@ class Emoji(_EmojiTag):
|
|||||||
return '<a:{0.name}:{0.id}>'.format(self)
|
return '<a:{0.name}:{0.id}>'.format(self)
|
||||||
return "<:{0.name}:{0.id}>".format(self)
|
return "<:{0.name}:{0.id}>".format(self)
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Emoji id={0.id} name={0.name!r} animated={0.animated} managed={0.managed}>'.format(self)
|
return '<Emoji id={0.id} name={0.name!r} animated={0.animated} managed={0.managed}>'.format(self)
|
||||||
|
|
||||||
|
@ -207,6 +207,9 @@ class Guild(Hashable):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
attrs = (
|
attrs = (
|
||||||
'id', 'name', 'shard_id', 'chunked'
|
'id', 'name', 'shard_id', 'chunked'
|
||||||
|
@ -84,6 +84,9 @@ class Attachment:
|
|||||||
""":class:`bool`: Whether this attachment contains a spoiler."""
|
""":class:`bool`: Whether this attachment contains a spoiler."""
|
||||||
return self.filename.startswith('SPOILER_')
|
return self.filename.startswith('SPOILER_')
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Attachment id={0.id} filename={0.filename!r} url={0.url!r}>'.format(self)
|
return '<Attachment id={0.id} filename={0.filename!r} url={0.url!r}>'.format(self)
|
||||||
|
|
||||||
@ -388,6 +391,9 @@ class Message:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.content
|
return self.content
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
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)
|
return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self)
|
||||||
|
|
||||||
|
@ -99,6 +99,9 @@ class Role(Hashable):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Role id={0.id} name={0.name!r}>'.format(self)
|
return '<Role id={0.id} name={0.name!r}>'.format(self)
|
||||||
|
|
||||||
|
@ -92,6 +92,9 @@ class BaseUser(_BaseUser):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{0.name}#{0.discriminator}'.format(self)
|
return '{0.name}#{0.discriminator}'.format(self)
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return isinstance(other, _BaseUser) and other.id == self.id
|
return isinstance(other, _BaseUser) and other.id == self.id
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ Custom Features
|
|||||||
- Added ``Client.set_embed_color`` / ``Bot.set_embed_color``
|
- Added ``Client.set_embed_color`` / ``Bot.set_embed_color``
|
||||||
- Added ``TextChannel.can_send``
|
- Added ``TextChannel.can_send``
|
||||||
- Added ``Intents.from_list``
|
- Added ``Intents.from_list``
|
||||||
|
- Added support for ``int()`` to ``discord.User``, ``discord.Member``, ``discord.Emoji``, ``discord.Role``, ``discord.Guild``, ``discord.Message``, ``discord.TextChannel``, ``discord.VoiceChannel``, ``discord.CategoryChannel``, ``discord.Attachment`` and ``discord.Message``. This will return their id
|
||||||
- Added support for ``str()`` to ``discord.Message``. This will return the message content
|
- Added support for ``str()`` to ``discord.Message``. This will return the message content
|
||||||
|
|
||||||
Features
|
Features
|
||||||
|
Loading…
x
Reference in New Issue
Block a user