mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(GuildPreview): add createdAt & createdTimestamp (#6130)
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
This commit is contained in:
@@ -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,23 @@ 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.
|
||||
|
||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -758,6 +758,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<Snowflake, GuildPreviewEmoji>;
|
||||
|
||||
Reference in New Issue
Block a user