Class LegacyInviteCreateSpec

  • All Implemented Interfaces:
    LegacyAuditSpec<discord4j.discordjson.json.InviteCreateRequest>, LegacySpec<discord4j.discordjson.json.InviteCreateRequest>

    public class LegacyInviteCreateSpec
    extends Object
    implements LegacyAuditSpec<discord4j.discordjson.json.InviteCreateRequest>
    LegacySpec used to create guild channel Invite objects.
    See Also:
    Create Channel Invite
    • Constructor Detail

      • LegacyInviteCreateSpec

        public LegacyInviteCreateSpec()
    • Method Detail

      • setMaxAge

        public LegacyInviteCreateSpec setMaxAge​(int maxAge)
        Sets the duration of the created Invite in seconds before expiration, or 0 to never expire. If unset, the default of 24 hours will be used.
        Parameters:
        maxAge - The duration of the invite in seconds, or 0 to never expire.
        Returns:
        This spec.
      • setMaxUses

        public LegacyInviteCreateSpec setMaxUses​(int maxUses)
        Sets the maximum number of uses the created Invite has before expiring, or 0 for unlimited uses. If unset, the default is unlimited usages.
        Parameters:
        maxUses - The maximum number of uses, or 0 for unlimited usage.
        Returns:
        This spec.
      • setTemporary

        public LegacyInviteCreateSpec setTemporary​(boolean temporary)
        Sets whether the created Invite only grants temporary membership. This property is false by default.
        Parameters:
        temporary - true if this invite is temporary, false otherwise.
        Returns:
        This spec.
      • setUnique

        public LegacyInviteCreateSpec setUnique​(boolean unique)
        Sets whether the created Invite is unique. If true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
        Parameters:
        unique - true if the created invite is unique, false otherwise.
        Returns:
        This spec.
      • setTargetType

        public LegacyInviteCreateSpec setTargetType​(Invite.Type targetType)
        Sets the type of target for this voice channel invite.
        Parameters:
        targetType - The type of target for this voice channel invite.
        Returns:
        This spec.
      • setTargetUserId

        public LegacyInviteCreateSpec setTargetUserId​(Snowflake targetUserId)
        Sets the id of the user whose stream to display for this invite, required if `target_type` is 1, the user must be streaming in the channel.
        Parameters:
        targetUserId - The id of the user whose stream to display for this invite.
        Returns:
        This spec.
      • setTargetApplicationId

        public LegacyInviteCreateSpec setTargetApplicationId​(Snowflake targetApplicationId)
        Sets the id of the embedded application to open for this invite, required if `target_type` is 2, the application must have the `EMBEDDED` flag.
        Parameters:
        targetApplicationId - The id of the embedded application to open for this invite.
        Returns:
        This spec.
      • getReason

        @Nullable
        public String getReason()
        Description copied from interface: LegacyAuditSpec
        Returns the current audit log reason set on the spec.
        Specified by:
        getReason in interface LegacyAuditSpec<discord4j.discordjson.json.InviteCreateRequest>
        Returns:
        The current audit log reason.
      • asRequest

        public discord4j.discordjson.json.InviteCreateRequest asRequest()
        Specified by:
        asRequest in interface LegacySpec<discord4j.discordjson.json.InviteCreateRequest>