createdAt

This commit is contained in:
abalabahaha
2016-05-31 18:52:41 -07:00
parent d913d04f44
commit bd15cc68ce
12 changed files with 60 additions and 1 deletions

View File

@@ -27,6 +27,11 @@ isPrivate
Indicates whether the channel is PM channel, is `Boolean`. Indicates whether the channel is PM channel, is `Boolean`.
createdAt
~~~~~~~~~
A `Date` referring to when the channel was created.
-------- --------
Functions Functions

View File

@@ -50,6 +50,11 @@ client
The Client_ that cached the role. The Client_ that cached the role.
createdAt
~~~~~~~~~
A `Date` referring to when the role was created.
Functions Functions
--------- ---------

View File

@@ -79,6 +79,11 @@ iconURL
The URL of the Server's icon. If the server doesn't have an icon, this will be null. The URL of the Server's icon. If the server doesn't have an icon, this will be null.
createdAt
~~~~~~~~~
A `Date` referring to when the server was created.
Functions Functions
--------- ---------

View File

@@ -82,6 +82,11 @@ voiceChannel
The VoiceChannel_ the user is connected to. If they aren't in any voice channels, this will be ``null``. The VoiceChannel_ the user is connected to. If they aren't in any voice channels, this will be ``null``.
createdAt
~~~~~~~~~
A `Date` referring to when the user was created.
Functions Functions
--------- ---------

View File

@@ -32,6 +32,11 @@ var Channel = (function (_Equality) {
}; };
_createClass(Channel, [{ _createClass(Channel, [{
key: "createdAt",
get: function get() {
return new Date(+this.id / 4194304 + 1420070400000);
}
}, {
key: "isPrivate", key: "isPrivate",
get: function get() { get: function get() {
return !this.server; return !this.server;

View File

@@ -1,6 +1,8 @@
"use strict"; "use strict";
exports.__esModule = true; exports.__esModule = true;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _Constants = require("../Constants"); var _Constants = require("../Constants");
@@ -175,6 +177,13 @@ var Role = (function () {
return this.mention(); return this.mention();
}; };
_createClass(Role, [{
key: "createdAt",
get: function get() {
return new Date(+this.id / 4194304 + 1420070400000);
}
}]);
return Role; return Role;
})(); })();

View File

@@ -375,6 +375,11 @@ var Server = (function (_Equality) {
}; };
_createClass(Server, [{ _createClass(Server, [{
key: "createdAt",
get: function get() {
return new Date(+this.id / 4194304 + 1420070400000);
}
}, {
key: "iconURL", key: "iconURL",
get: function get() { get: function get() {
if (!this.icon) { if (!this.icon) {

View File

@@ -102,6 +102,11 @@ var User = (function (_Equality) {
}; };
_createClass(User, [{ _createClass(User, [{
key: "createdAt",
get: function get() {
return new Date(+this.id / 4194304 + 1420070400000);
}
}, {
key: "avatarURL", key: "avatarURL",
get: function get() { get: function get() {
if (!this.avatar) { if (!this.avatar) {

View File

@@ -4,13 +4,16 @@ import Equality from "../Util/Equality";
import {reg} from "../Util/ArgumentRegulariser"; import {reg} from "../Util/ArgumentRegulariser";
export default class Channel extends Equality { export default class Channel extends Equality {
constructor(data, client){ constructor(data, client){
super(); super();
this.id = data.id; this.id = data.id;
this.client = client; this.client = client;
} }
get createdAt() {
return new Date((+this.id / 4194304) + 1420070400000);
}
get isPrivate() { get isPrivate() {
return !this.server; return !this.server;
} }

View File

@@ -43,6 +43,10 @@ export default class Role {
this.mentionable = data.mentionable || false; this.mentionable = data.mentionable || false;
} }
get createdAt() {
return new Date((+this.id / 4194304) + 1420070400000);
}
serialise(explicit){ serialise(explicit){
var hp = (perm) => this.hasPermission(perm, explicit); var hp = (perm) => this.hasPermission(perm, explicit);

View File

@@ -106,6 +106,10 @@ export default class Server extends Equality {
} }
} }
get createdAt() {
return new Date((+this.id / 4194304) + 1420070400000);
}
detailsOf(user) { detailsOf(user) {
user = this.client.internal.resolver.resolveUser(user); user = this.client.internal.resolver.resolveUser(user);
if (user) { if (user) {

View File

@@ -23,6 +23,10 @@ export default class User extends Equality{
this.voiceState = {}; this.voiceState = {};
} }
get createdAt() {
return new Date((+this.id / 4194304) + 1420070400000);
}
get avatarURL(){ get avatarURL(){
if(!this.avatar){ if(!this.avatar){
return null; return null;