diff options
| author | Rapptz <[email protected]> | 2016-03-06 03:47:25 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-03-06 03:47:25 -0500 |
| commit | f437ffe44ea55eb8e4f47aa99a4c92794a9b96d8 (patch) | |
| tree | 32dbd372e430f110643b4b21145cf725e9fedac8 | |
| parent | Clean up documentation of utils.snowflake_time (diff) | |
| download | discord.py-f437ffe44ea55eb8e4f47aa99a4c92794a9b96d8.tar.xz discord.py-f437ffe44ea55eb8e4f47aa99a4c92794a9b96d8.zip | |
Add created_at properties for Server and User.
| -rw-r--r-- | discord/server.py | 5 | ||||
| -rw-r--r-- | discord/user.py | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/discord/server.py b/discord/server.py index 1d4aae11..3d1a1b51 100644 --- a/discord/server.py +++ b/discord/server.py @@ -218,3 +218,8 @@ class Server(Hashable): def member_count(self): """Returns the true member count regardless of it being loaded fully or not.""" return self._member_count + + @property + def created_at(self): + """Returns the server's creation time in UTC.""" + return utils.snowflake_time(self.id) diff --git a/discord/user.py b/discord/user.py index b10d864b..0d08d0a9 100644 --- a/discord/user.py +++ b/discord/user.py @@ -24,6 +24,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 User: """Represents a Discord user. @@ -102,3 +104,10 @@ class User: """ return channel.permissions_for(self) + @property + def created_at(self): + """Returns the user's creation time in UTC. + + This is when the user's discord account was created.""" + return snowflake_time(self.id) + |