From adce25c49bd456479b5896140948df1b875dac2e Mon Sep 17 00:00:00 2001 From: GoldenAngel <50855202+GoldenAngel2@users.noreply.github.com> Date: Sat, 17 Jul 2021 03:33:14 -0700 Subject: [PATCH 1/3] Update index.d.ts --- typings/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/typings/index.d.ts b/typings/index.d.ts index b61687fd34f8..9970327df4da 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -711,6 +711,8 @@ export class GuildPreview extends Base { public constructor(client: Client, data: unknown); public approximateMemberCount: number; public approximatePresenceCount: number; + public readonly createdAt: Date; + public readonly createdTimestamp: number; public description: string | null; public discoverySplash: string | null; public emojis: Collection; From 71debd2b2cd2250e879770aa4583d0f78fafc983 Mon Sep 17 00:00:00 2001 From: GoldenAngel <50855202+GoldenAngel2@users.noreply.github.com> Date: Sat, 17 Jul 2021 03:33:40 -0700 Subject: [PATCH 2/3] Add createdAt & createdTimestamp --- src/structures/GuildPreview.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/structures/GuildPreview.js b/src/structures/GuildPreview.js index 57bacd27a02f..450070e203da 100644 --- a/src/structures/GuildPreview.js +++ b/src/structures/GuildPreview.js @@ -3,6 +3,7 @@ const Base = require('./Base'); const GuildPreviewEmoji = require('./GuildPreviewEmoji'); const Collection = require('../util/Collection'); +const SnowflakeUtil = require('../util/SnowflakeUtil'); /** * Represents the data about the guild any bot can preview, connected to the specified guild. @@ -90,6 +91,24 @@ class GuildPreview extends Base { this.emojis.set(emoji.id, new GuildPreviewEmoji(this.client, emoji, this)); } } + + /** + * The timestamp this guild was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return SnowflakeUtil.deconstruct(this.id).timestamp; + } + + /** + * The time this guild was created at + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } /** * The URL to this guild's splash. From 7eb2134b200e1df4adc2252e9bb033151d0dd37f Mon Sep 17 00:00:00 2001 From: GoldenAngel <50855202+GoldenAngel2@users.noreply.github.com> Date: Sat, 17 Jul 2021 04:13:30 -0700 Subject: [PATCH 3/3] Update src/structures/GuildPreview.js Co-authored-by: SpaceEEC --- src/structures/GuildPreview.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/structures/GuildPreview.js b/src/structures/GuildPreview.js index 450070e203da..5a32e40a7bdb 100644 --- a/src/structures/GuildPreview.js +++ b/src/structures/GuildPreview.js @@ -91,7 +91,6 @@ class GuildPreview extends Base { this.emojis.set(emoji.id, new GuildPreviewEmoji(this.client, emoji, this)); } } - /** * The timestamp this guild was created at * @type {number}