mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-20 16:00:29 +00:00
Add missing created_at properties for other objects.
Such as Channel, PrivateChannel, Object and Role.
This commit is contained in:
parent
050c668eac
commit
2ef38107d8
@ -143,6 +143,11 @@ class Channel(Hashable):
|
||||
"""str : The string that allows you to mention the channel."""
|
||||
return '<#{0.id}>'.format(self)
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""Returns the channel's creation time in UTC."""
|
||||
return utils.snowflake_time(self.id)
|
||||
|
||||
def permissions_for(self, member):
|
||||
"""Handles permission resolution for the current :class:`Member`.
|
||||
|
||||
@ -255,6 +260,11 @@ class PrivateChannel(Hashable):
|
||||
def __str__(self):
|
||||
return 'Direct Message with {0.name}'.format(self.user)
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""Returns the private channel's creation time in UTC."""
|
||||
return utils.snowflake_time(self.id)
|
||||
|
||||
def permissions_for(self, user):
|
||||
"""Handles permission resolution for a :class:`User`.
|
||||
|
||||
|
@ -23,6 +23,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from .utils import snowflake_time
|
||||
|
||||
class Object:
|
||||
"""Represents a generic Discord object.
|
||||
|
||||
@ -45,3 +47,8 @@ class Object:
|
||||
|
||||
def __init__(self, id):
|
||||
self.id = id
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""Returns the private channel's creation time in UTC."""
|
||||
return utils.snowflake_time(self.id)
|
||||
|
@ -27,6 +27,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from .permissions import Permissions
|
||||
from .colour import Colour
|
||||
from .mixins import Hashable
|
||||
from .utils import snowflake_time
|
||||
|
||||
class Role(Hashable):
|
||||
"""Represents a Discord role in a :class:`Server`.
|
||||
@ -90,3 +91,8 @@ class Role(Hashable):
|
||||
def is_everyone(self):
|
||||
"""Checks if the role is the @everyone role."""
|
||||
return self._is_everyone
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""Returns the role's creation time in UTC."""
|
||||
return utils.snowflake_time(self.id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user