Represents the payload for creating a Discord invite. This class encapsulates all parameters needed to create an invite.

Constructors

  • Creates a new InvitePayload instance.

    Parameters

    • Optionaldata: {
          max_age?: number;
          max_uses?: number;
          target_application_id?: string;
          target_type?: number;
          target_user_id?: string;
          temporary?: boolean;
          unique?: boolean;
      }

      Optional initial data to set in the payload.

      • Optionalmax_age?: number
      • Optionalmax_uses?: number
      • Optionaltarget_application_id?: string
      • Optionaltarget_type?: number
      • Optionaltarget_user_id?: string
      • Optionaltemporary?: boolean
      • Optionalunique?: boolean

    Returns InvitePayload

Accessors

  • get maxAge(): number
  • Gets the duration (in seconds) before the invite expires. 0 means the invite never expires. Must be between 0 and 604800 (7 days).

    Returns number

    The invite expiration duration in seconds.

  • set maxAge(value): void
  • Sets the duration (in seconds) before the invite expires.

    Parameters

    • value: number

      Duration in seconds (0 to 604800).

    Returns void

    Error if the value is out of range.

  • get maxUses(): number
  • Gets the maximum number of uses for the invite. 0 means unlimited uses. Must be between 0 and 100.

    Returns number

    The maximum number of uses.

  • set maxUses(value): void
  • Sets the maximum number of uses for the invite.

    Parameters

    • value: number

      Maximum uses (0 to 100).

    Returns void

    Error if the value is out of range.

  • get targetApplicationId(): string
  • Gets the ID of the embedded application to launch. Required if target_type is 2 (Embedded Application).

    Returns string

    The target application ID.

  • set targetApplicationId(value): void
  • Sets the ID of the embedded application to launch.

    Parameters

    • value: string

      Target application ID.

    Returns void

  • get targetType(): number
  • Gets the target type of the voice channel invite. 1 = Stream, 2 = Embedded Application.

    Returns number

    The target type number.

  • set targetType(value): void
  • Sets the target type of the voice channel invite.

    Parameters

    • value: number

      Target type (1 for Stream, 2 for Embedded Application).

    Returns void

    Error if the value is not 1 or 2.

  • get targetUserId(): string
  • Gets the user ID whose stream should be displayed. Required if target_type is 1 (Stream).

    Returns string

    The target user ID.

  • set targetUserId(value): void
  • Sets the user ID whose stream should be displayed.

    Parameters

    • value: string

      Target user ID.

    Returns void

  • get temporary(): boolean
  • Gets whether the invite grants temporary membership.

    Returns boolean

    True if temporary membership is granted.

  • set temporary(value): void
  • Sets whether the invite grants temporary membership.

    Parameters

    • value: boolean

      True to grant temporary membership.

    Returns void

  • get unique(): boolean
  • Gets whether the invite should always create a new unique invite. Useful for generating one-time-use invites.

    Returns boolean

    True if invite is unique.

  • set unique(value): void
  • Sets whether the invite should always create a new unique invite.

    Parameters

    • value: boolean

      True to create a unique invite.

    Returns void

Methods

  • Converts the payload to a JSON-serializable object.

    Returns any

    A JSON object representation of the invite payload.