Add int() support to Role

This commit is contained in:
Arthur Jovart 2021-08-29 01:06:18 +02:00
parent 3ce86f6cde
commit 9d1df65af3
No known key found for this signature in database
GPG Key ID: DE4444AAAAAAAAAA

View File

@ -141,6 +141,10 @@ class Role(Hashable):
Returns the role's name.
.. describe:: str(x)
Returns the role's ID.
Attributes
----------
id: :class:`int`
@ -195,6 +199,9 @@ class Role(Hashable):
def __str__(self) -> str:
return self.name
def __int__(self) -> int:
return self.id
def __repr__(self) -> str:
return f'<Role id={self.id} name={self.name!r}>'