Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(Invite): add info blocks for missing props #7014

Merged
merged 1 commit into from
Dec 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/structures/Invite.js
Original file line number Diff line number Diff line change
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