Skip to content

Commit

Permalink
docs(Invite): add info blocks for missing props (discordjs#7014)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Dec 1, 2021
1 parent da86bd4 commit b183a8e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/structures/Invite.js
Expand Up @@ -9,7 +9,6 @@ const Permissions = require('../util/Permissions');

/**
* Represents an invitation to a guild channel.
* <warn>The only guaranteed properties are `code`, `channel`, and `url`. Other properties can be missing.</warn>
* @extends {Base}
*/
class Invite extends Base {
Expand Down Expand Up @@ -40,6 +39,7 @@ class Invite extends Base {
if ('approximate_presence_count' in data) {
/**
* The approximate number of online members of the guild this invite is for
* <info>This is only available when the invite was fetched through {@link Client#fetchInvite}.</info>
* @type {?number}
*/
this.presenceCount = data.approximate_presence_count;
Expand All @@ -50,6 +50,7 @@ class Invite extends Base {
if ('approximate_member_count' in data) {
/**
* The approximate total number of members of the guild this invite is for
* <info>This is only available when the invite was fetched through {@link Client#fetchInvite}.</info>
* @type {?number}
*/
this.memberCount = data.approximate_member_count;
Expand All @@ -60,6 +61,8 @@ class Invite extends Base {
if ('temporary' in data) {
/**
* Whether or not this invite only grants temporary membership
* <info>This is only available when the invite was fetched through {@link GuildInviteManager#fetch}
* or created through {@link GuildInviteManager#create}.</info>
* @type {?boolean}
*/
this.temporary = data.temporary ?? null;
Expand All @@ -70,6 +73,8 @@ class Invite extends Base {
if ('max_age' in data) {
/**
* The maximum age of the invite, in seconds, 0 if never expires
* <info>This is only available when the invite was fetched through {@link GuildInviteManager#fetch}
* or created through {@link GuildInviteManager#create}.</info>
* @type {?number}
*/
this.maxAge = data.max_age;
Expand All @@ -80,6 +85,8 @@ class Invite extends Base {
if ('uses' in data) {
/**
* How many times this invite has been used
* <info>This is only available when the invite was fetched through {@link GuildInviteManager#fetch}
* or created through {@link GuildInviteManager#create}.</info>
* @type {?number}
*/
this.uses = data.uses;
Expand All @@ -90,6 +97,8 @@ class Invite extends Base {
if ('max_uses' in data) {
/**
* The maximum uses of this invite
* <info>This is only available when the invite was fetched through {@link GuildInviteManager#fetch}
* or created through {@link GuildInviteManager#create}.</info>
* @type {?number}
*/
this.maxUses = data.max_uses;
Expand Down Expand Up @@ -147,15 +156,15 @@ class Invite extends Base {

if ('channel' in data) {
/**
* The channel the invite is for
* The channel this invite is for
* @type {Channel}
*/
this.channel = this.client.channels._add(data.channel, this.guild, { cache: false });
}

if ('created_at' in data) {
/**
* The timestamp the invite was created at
* The timestamp this invite was created at
* @type {?number}
*/
this.createdTimestamp = new Date(data.created_at).getTime();
Expand Down

0 comments on commit b183a8e

Please sign in to comment.