Skip to content

Commit

Permalink
fix(StoreChannel): add invite methods
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Aug 1, 2021
1 parent 2504258 commit 2581317
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/structures/StoreChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ class StoreChannel extends GuildChannel {
this.nsfw = Boolean(data.nsfw);
}
}

/**
* Creates an invite to this guild channel.
* @param {CreateInviteOptions} [options={}] The options for creating the invite
* @returns {Promise<Invite>}
* @example
* // Create an invite to a channel
* channel.createInvite()
* .then(invite => console.log(`Created an invite with a code of ${invite.code}`))
* .catch(console.error);
*/
createInvite(options) {
return this.guild.invites.create(this.id, options);
}

/**
* Fetches a collection of invites to this guild channel.
* Resolves with a collection mapping invites by their codes.
* @param {boolean} [cache=true] Whether or not to cache the fetched invites
* @returns {Promise<Collection<string, Invite>>}
*/
fetchInvites(cache = true) {
return this.guild.invites.fetch({ channelId: this.id, cache });
}
}

module.exports = StoreChannel;
2 changes: 2 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,8 @@ export class StickerPack extends Base {

export class StoreChannel extends GuildChannel {
public constructor(guild: Guild, data?: RawGuildChannelData, client?: Client);
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
public nsfw: boolean;
public type: 'GUILD_STORE';
}
Expand Down

0 comments on commit 2581317

Please sign in to comment.