Package discord4j.core.spec
Class InviteCreateSpec
- java.lang.Object
-
- discord4j.core.spec.InviteCreateSpec
-
- All Implemented Interfaces:
AuditSpec<discord4j.discordjson.json.InviteCreateRequest>
,Spec<discord4j.discordjson.json.InviteCreateRequest>
public class InviteCreateSpec extends Object implements AuditSpec<discord4j.discordjson.json.InviteCreateRequest>
Spec used to create guild channelInvite
objects.- See Also:
- Create Channel Invite
-
-
Constructor Summary
Constructors Constructor Description InviteCreateSpec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description discord4j.discordjson.json.InviteCreateRequest
asRequest()
String
getReason()
Returns the current audit log reason set on the spec.InviteCreateSpec
setMaxAge(int maxAge)
Sets the duration of the createdInvite
in seconds before expiration, or0
to never expire.InviteCreateSpec
setMaxUses(int maxUses)
Sets the maximum number of uses the createdInvite
has before expiring, or0
for unlimited uses.InviteCreateSpec
setReason(String reason)
Sets the reason to show in the audit logs when the spec is built.InviteCreateSpec
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.InviteCreateSpec
setTargetType(Invite.Type targetType)
Sets the type of target for this voice channel invite.InviteCreateSpec
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.InviteCreateSpec
setTemporary(boolean temporary)
Sets whether the createdInvite
only grants temporary membership.InviteCreateSpec
setUnique(boolean unique)
Sets whether the createdInvite
is unique.
-
-
-
Method Detail
-
setMaxAge
public InviteCreateSpec setMaxAge(int maxAge)
Sets the duration of the createdInvite
in seconds before expiration, or0
to never expire. If unset, the default of 24 hours will be used.- Parameters:
maxAge
- The duration of the invite in seconds, or0
to never expire.- Returns:
- This spec.
-
setMaxUses
public InviteCreateSpec setMaxUses(int maxUses)
Sets the maximum number of uses the createdInvite
has before expiring, or0
for unlimited uses. If unset, the default is unlimited usages.- Parameters:
maxUses
- The maximum number of uses, or0
for unlimited usage.- Returns:
- This spec.
-
setTemporary
public InviteCreateSpec setTemporary(boolean temporary)
Sets whether the createdInvite
only grants temporary membership. This property isfalse
by default.- Parameters:
temporary
-true
if this invite is temporary,false
otherwise.- Returns:
- This spec.
-
setUnique
public InviteCreateSpec setUnique(boolean unique)
Sets whether the createdInvite
is unique. Iftrue
, 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 InviteCreateSpec 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 InviteCreateSpec 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 InviteCreateSpec 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 InviteCreateSpec setReason(@Nullable String reason)
Description copied from interface:AuditSpec
Sets the reason to show in the audit logs when the spec is built.
-
getReason
@Nullable public String getReason()
Description copied from interface:AuditSpec
Returns the current audit log reason set on the spec.
-
-