Skip to content

Commit

Permalink
fix(Thread): make archive_timestamp not nullable (#5965)
Browse files Browse the repository at this point in the history
  • Loading branch information
DTrombett committed Jun 29, 2021
1 parent 1925d01 commit edab5af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/structures/ThreadChannel.js
Expand Up @@ -99,12 +99,11 @@ class ThreadChannel extends Channel {
this.rateLimitPerUser = data.rate_limit_per_user ?? 0;

/**
* The timestamp the thread was last archived or unarchived at
* @type {?number}
* The timestamp when the thread's archive status was last changed
* <info>If the thread was never archived or unarchived, this is set when it's created</info>
* @type {number}
*/
this.archiveTimestamp = data.thread_metadata.archive_timestamp
? new Date(data.thread_metadata.archive_timestamp).getTime()
: null;
this.archiveTimestamp = new Date(data.thread_metadata.archive_timestamp).getTime();

/**
* The approximate count of messages in this thread
Expand Down Expand Up @@ -135,12 +134,13 @@ class ThreadChannel extends Channel {
}

/**
* The time the thread was last archived or unarchived at
* @type {?Date}
* The time when the thread's archive status was last changed
* <info>If the thread was never archived or unarchived, this is set when it's created</info>
* @type {Date}
* @readonly
*/
get archivedAt() {
return this.archiveTimestamp ? new Date(this.archiveTimestamp) : null;
return new Date(this.archiveTimestamp);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions typings/index.d.ts
Expand Up @@ -1951,8 +1951,8 @@ declare module 'discord.js' {
export class ThreadChannel extends TextBasedChannel(Channel) {
constructor(guild: Guild, data?: object);
public archived: boolean;
public readonly archivedAt: Date | null;
public archiveTimestamp: number | null;
public readonly archivedAt: Date;
public archiveTimestamp: number;
public autoArchiveDuration: ThreadAutoArchiveDuration;
public readonly editable: boolean;
public guild: Guild;
Expand Down

0 comments on commit edab5af

Please sign in to comment.