Invite

class Invite()

A Discord invite and any metadata returned for it by the current endpoint. Count, expiration, and inviter-related fields may be absent depending on how the invite was obtained and which options were requested.

exported from lib.weeble.d

Properties

Invite.approximateMemberCount

type: readonly number | null

Approximate member count at the time the invite was fetched, or null.

Invite.approximatePresenceCount

type: readonly number | null

Approximate online member count, or null.

Invite.channel

type: readonly InviteChannel | null

Partial target channel information included with the invite.

Invite.channelId

type: readonly string | null

Channel ID the invite targets, or null.

Invite.code

type: readonly string

The invite code used in discord.gg/ links.

Invite.createdAt

type: readonly Date | null

When this invite was created, or null.

Invite.expiresAt

type: readonly Date | null

When this invite expires, or null.

Invite.guild

type: readonly InviteGuild | null

Partial target guild information included with the invite.

Invite.guildId

type: readonly string | null

Guild ID the invite targets, or null.

Invite.inviter

type: readonly User | null

User who created the invite when Discord includes it.

Invite.maxAge

type: readonly number | null

Duration in seconds before the invite expires, or null.

Invite.maxUses

type: readonly number | null

Maximum number of uses. 0 means unlimited; null means Discord omitted the field.

Invite.targetApplication

type: readonly Record<string, unknown> | null

Target application metadata when Discord includes it.

Invite.targetType

type: readonly number | null

Type of invite target, or null for an ordinary channel invite.

Invite.targetUser

type: readonly User | null

Target user for stream or embedded-application invites.

Invite.temporary

type: readonly boolean | null

Indicates whether this invite grants temporary membership, or null.

Invite.uses

type: readonly number | null

Number of times this invite has been used, or null.

Methods

async Invite.delete(reason: string) Promise<void>

Delete this invite.

Parameters:
  • reason — – Audit-log reason for deleting the invite.

async Invite.fetch() Promise<Invite>

Refetch the latest invite data from Discord.

Returns:

The updated invite object.

async Invite.fetchChannel() Promise<GuildTextChannel | GuildVoiceChannel | null>

Fetch the complete channel this invite targets through Discord REST. Deployment guild isolation applies. Use invite.channel for the public partial channel included with external invite responses.

Returns:

The channel, or null if not available.

async Invite.fetchGuild() Promise<Guild | null>

Fetch the complete guild this invite targets through Discord REST. Deployment guild isolation applies. Use invite.guild for the public partial guild included with external invite responses.

Returns:

The guild, or null if not available.