Package discord4j.core.spec.legacy
Class LegacyInviteCreateSpec
- java.lang.Object
-
- discord4j.core.spec.legacy.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 channelInviteobjects.- See Also:
- Create Channel Invite
-
-
Constructor Summary
Constructors Constructor Description LegacyInviteCreateSpec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description discord4j.discordjson.json.InviteCreateRequestasRequest()StringgetReason()Returns the current audit log reason set on the spec.LegacyInviteCreateSpecsetMaxAge(int maxAge)Sets the duration of the createdInvitein seconds before expiration, or0to never expire.LegacyInviteCreateSpecsetMaxUses(int maxUses)Sets the maximum number of uses the createdInvitehas before expiring, or0for unlimited uses.LegacyInviteCreateSpecsetReason(String reason)Sets the reason to show in the audit logs when the spec is built.LegacyInviteCreateSpecsetTargetApplicationId(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.LegacyInviteCreateSpecsetTargetType(Invite.Type targetType)Sets the type of target for this voice channel invite.LegacyInviteCreateSpecsetTargetUserId(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.LegacyInviteCreateSpecsetTemporary(boolean temporary)Sets whether the createdInviteonly grants temporary membership.LegacyInviteCreateSpecsetUnique(boolean unique)Sets whether the createdInviteis unique.
-
-
-
Method Detail
-
setMaxAge
public LegacyInviteCreateSpec setMaxAge(int maxAge)
Sets the duration of the createdInvitein seconds before expiration, or0to never expire. If unset, the default of 24 hours will be used.- Parameters:
maxAge- The duration of the invite in seconds, or0to never expire.- Returns:
- This spec.
-
setMaxUses
public LegacyInviteCreateSpec setMaxUses(int maxUses)
Sets the maximum number of uses the createdInvitehas before expiring, or0for unlimited uses. If unset, the default is unlimited usages.- Parameters:
maxUses- The maximum number of uses, or0for unlimited usage.- Returns:
- This spec.
-
setTemporary
public LegacyInviteCreateSpec setTemporary(boolean temporary)
Sets whether the createdInviteonly grants temporary membership. This property isfalseby default.- Parameters:
temporary-trueif this invite is temporary,falseotherwise.- Returns:
- This spec.
-
setUnique
public LegacyInviteCreateSpec setUnique(boolean unique)
Sets whether the createdInviteis unique. Iftrue, don't try to reuse a similar invite (useful for creating many unique one time use invites).- Parameters:
unique-trueif the created invite is unique,falseotherwise.- 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.
-
setReason
public LegacyInviteCreateSpec setReason(@Nullable String reason)
Description copied from interface:LegacyAuditSpecSets the reason to show in the audit logs when the spec is built.- Specified by:
setReasonin interfaceLegacyAuditSpec<discord4j.discordjson.json.InviteCreateRequest>- Parameters:
reason- The audit log reason.- Returns:
- This spec.
-
getReason
@Nullable public String getReason()
Description copied from interface:LegacyAuditSpecReturns the current audit log reason set on the spec.- Specified by:
getReasonin interfaceLegacyAuditSpec<discord4j.discordjson.json.InviteCreateRequest>- Returns:
- The current audit log reason.
-
asRequest
public discord4j.discordjson.json.InviteCreateRequest asRequest()
- Specified by:
asRequestin interfaceLegacySpec<discord4j.discordjson.json.InviteCreateRequest>
-
-