Preview environment

class Invite

extends

Base
export class Invite extends Base

Represents an invitation to a guild channel.

The channel this invite is for

channelId : Snowflake | null

The id of the channel this invite is for

readonly
client : Client<true>

The client that instantiated this

Inherited from: Base

code : string

The code for this invite

readonly
createdAt : Date | null

The time the invite was created at

createdTimestamp : number | null

The timestamp this invite was created at

readonly
deletable : boolean

Whether the invite is deletable by the client user

readonly
expiresAt : Date | null

The time the invite will expire at

readonly
expiresTimestamp : number | null

The timestamp the invite will expire at

guild : InviteGuild | Guild | null

The guild the invite is for including welcome screen data if present

guildScheduledEvent : GuildScheduledEvent | null

The guild scheduled event data if there is a GuildScheduledEvent in the channel this invite is for

readonly
inviter : User | null

The user who created this invite

inviterId : Snowflake | null

The user's id who created this invite

static
InvitesPattern : RegExp

A regular expression that matches Discord invite links. The code group property is present on the exec() result of this expression.

maxAge : number | null

The maximum age of the invite, in seconds, 0 if never expires This is only available when the invite was fetched through fetch or created through create.

maxUses : number | null

The maximum uses of this invite This is only available when the invite was fetched through fetch or created through create.

memberCount : number

The approximate total number of members of the guild this invite is for This is only available when the invite was fetched through fetchInvite.

presenceCount : number

The approximate number of online members of the guild this invite is for This is only available when the invite was fetched through fetchInvite.

deprecated
stageInstance : InviteStageInstance | null

The stage instance data if there is a public StageInstance in the stage channel this invite is for

targetApplication : IntegrationApplication | null

The embedded application to open for this voice channel embedded application invite

targetType : InviteTargetType | null

The target type

targetUser : User | null

The user whose stream to display for this voice channel stream invite

temporary : boolean | null

Whether or not this invite only grants temporary membership This is only available when the invite was fetched through fetch or created through create.

type : InviteType

The type of this invite

readonly
url : string

The URL to the invite

uses : number | null

How many times this invite has been used This is only available when the invite was fetched through fetch or created through create.

delete(
reason?: string
) : Promise<Invite>

Deletes this invite.

toJSON() : unknown

toString() : string

When concatenated with a string, this automatically concatenates the invite's URL instead of the object.

Examples:
// Logs: Invite: https://discord.gg/A1b2C3
console.log(`Invite: ${invite}`);

valueOf() : string

Inherited from: Base