Skip to content

GuildInviteManager

classe · Source

Manages API methods for GuildInvites and stores their cache.

Extends: CachedManager

Properties

guild

guild: Guild

The guild this Manager belongs to Source

cache

cache: Collection<string, Invite>

The cache of this Manager Source

_cache

readonly · private

_cache: Collection

The private cache of items for this manager. Source

holds

readonly · private

holds: function

The data structure belonging to this manager. Source

client

readonly

client: Client

The client that instantiated this Manager Source

Methods

resolve

resolve(invite: InviteResolvable): Invite

Resolves an InviteResolvable to an Invite object. Parameters

NameTypeDescription
inviteInviteResolvableThe invite resolvable to resolve

Returns: InviteSource

resolveId

resolveId(invite: InviteResolvable): string

Resolves an InviteResolvable to an invite code string. Parameters

NameTypeDescription
inviteInviteResolvableThe invite resolvable to resolve

Returns: stringSource

fetch

async

async fetch(options?: InviteResolvable | FetchInviteOptions | FetchInvitesOptions): Promise<(Invite|Collection<string, Invite>)>

Fetches invite(s) from Discord. Parameters

NameTypeDescription
options?InviteResolvable | FetchInviteOptions | FetchInvitesOptionsOptions for fetching guild invite(s)

Returns: Promise<(Invite\|Collection<string, Invite>)>

js
// Fetch all invites from a guild
guild.invites.fetch()
  .then(console.log)
  .catch(console.error);
js
// Fetch all invites from a guild without caching
guild.invites.fetch({ cache: false })
  .then(console.log)
  .catch(console.error);
js
// Fetch all invites from a channel
guild.invites.fetch({ channelId: '222197033908436994' })
  .then(console.log)
  .catch(console.error);
js
// Fetch a single invite
guild.invites.fetch('bRCvFy9')
  .then(console.log)
  .catch(console.error);
js
// Fetch a single invite without checking cache
guild.invites.fetch({ code: 'bRCvFy9', force: true })
  .then(console.log)
  .catch(console.error)
js
// Fetch a single invite without caching
guild.invites.fetch({ code: 'bRCvFy9', cache: false })
  .then(console.log)
  .catch(console.error);

Source

create

async

async create(channel: GuildInvitableChannelResolvable, options?: CreateInviteOptions): Promise<Invite>

Create an invite to the guild from the provided channel. Parameters

NameTypeDescription
channelGuildInvitableChannelResolvableThe options for creating the invite from a channel.
options?CreateInviteOptionsThe options for creating the invite from a channel. Default: {}.

Returns: Promise<Invite>

js
// Create an invite to a selected channel
guild.invites.create('599942732013764608')
  .then(console.log)
  .catch(console.error);

Source

delete

async

async delete(invite: InviteResolvable, reason?: string): Promise<void>

Deletes an invite. Parameters

NameTypeDescription
inviteInviteResolvableThe invite to delete
reason?stringReason for deleting the invite

Returns: Promise<void>Source

fetchTargetUsers

async

async fetchTargetUsers(invite: InviteResolvable): Promise<Array<Snowflake>>

Fetches the users allowed to see and accept a targeted invite. Parameters

NameTypeDescription
inviteInviteResolvableThe invite to fetch target users for

Returns: Promise<Array<Snowflake>>Source

updateTargetUsers

async

async updateTargetUsers(invite: InviteResolvable, targetUsersFile: TargetUsersFileResolvable): Promise<void>

Replaces the users allowed to see and accept a targeted invite. Parameters

NameTypeDescription
inviteInviteResolvableThe invite to update
targetUsersFileTargetUsersFileResolvableTarget-user CSV file or users

Returns: Promise<void>Source

fetchTargetUsersJobStatus

fetchTargetUsersJobStatus(invite: InviteResolvable): Promise<InviteTargetUsersJobStatus>

Fetches the processing status of a targeted-invite user list. Parameters

NameTypeDescription
inviteInviteResolvableThe invite to check

Returns: Promise<InviteTargetUsersJobStatus>Source

Unofficial software. Not affiliated with or supported by Discord.