Special methods #20

Merged
paris-ci merged 6 commits from special_methods into 2.0 2021-09-01 02:27:33 +00:00
Showing only changes of commit 22de755059 - Show all commits

View File

@@ -503,6 +503,14 @@ class Message(Hashable):
Returns the message's hash.
.. describe:: str(x)
Returns the message's content.
.. describe:: int(x)
Returns the message's ID.
Attributes
-----------
tts: :class:`bool`
@@ -712,6 +720,12 @@ class Message(Hashable):
f'<{name} id={self.id} channel={self.channel!r} type={self.type!r} author={self.author!r} flags={self.flags!r}>'
)
def __int__(self) -> int:
return self.id
def __str__(self) -> Optional[str]:
return self.content
def _try_patch(self, data, key, transform=None) -> None:
try:
value = data[key]