Class InviteImpl
java.lang.Object
net.dv8tion.jda.internal.entities.InviteImpl
- All Implemented Interfaces:
Invite
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.entities.Invite
Invite.Channel, Invite.EmbeddedApplication, Invite.Group, Invite.Guild, Invite.InviteTarget, Invite.InviteType, Invite.TargetType
-
Constructor Summary
ConstructorsConstructorDescriptionInviteImpl
(JDAImpl api, String code, boolean expanded, User inviter, int maxAge, int maxUses, boolean temporary, OffsetDateTime timeCreated, int uses, Invite.Channel channel, Invite.Guild guild, Invite.Group group, Invite.InviteTarget target, Invite.InviteType type) -
Method Summary
Modifier and TypeMethodDescriptiondelete()
Deletes this invite.boolean
expand()
Tries to retrieve a new expandedInvite
with more info.AnInvite.Channel
object containing information about this invite's origin channel.getCode()
The invite codegetGroup()
AnInvite.Group
object containing information about this invite's origin group.getGuild()
AnInvite.Guild
object containing information about this invite's origin guild.The user who created this invite.getJDA()
TheJDA
instance used to create this Inviteint
The max age of this invite in seconds.int
The max uses of this invite.AnInvite.InviteTarget
object containing information about this invite's target ornull
if this invite does not have a target.The target type of this invite orInvite.TargetType.NONE
if this invite does not have aInviteTarget
.Returns creation date of this invite.getType()
The type of this invite.int
getUses()
How often this invite has been used.int
hashCode()
boolean
Whether this Invite is expanded or not.boolean
Whether this Invite grants only temporary access or not.static RestAction
<Invite> toString()
-
Constructor Details
-
InviteImpl
public InviteImpl(JDAImpl api, String code, boolean expanded, User inviter, int maxAge, int maxUses, boolean temporary, OffsetDateTime timeCreated, int uses, Invite.Channel channel, Invite.Guild guild, Invite.Group group, Invite.InviteTarget target, Invite.InviteType type)
-
-
Method Details
-
resolve
-
delete
Description copied from interface:Invite
Deletes this invite.
RequiresMANAGE_CHANNEL
in the invite's channel. Will throw anInsufficientPermissionException
otherwise.- Specified by:
delete
in interfaceInvite
- Returns:
AuditableRestAction
-
expand
Description copied from interface:Invite
Tries to retrieve a new expandedInvite
with more info.
As bots can't be in groups this is only available for guild invites and will throw anIllegalStateException
for other types.
Requires eitherMANAGE_SERVER
in the invite's guild orMANAGE_CHANNEL
in the invite's channel. Will throw anInsufficientPermissionException
otherwise.- Specified by:
expand
in interfaceInvite
- Returns:
RestAction
- Type:Invite
The expanded Invite object- See Also:
-
getType
Description copied from interface:Invite
The type of this invite. -
getTargetType
Description copied from interface:Invite
The target type of this invite orInvite.TargetType.NONE
if this invite does not have aInviteTarget
.- Specified by:
getTargetType
in interfaceInvite
- Returns:
- The invite's target type or
Invite.TargetType.NONE
- See Also:
-
getChannel
Description copied from interface:Invite
AnInvite.Channel
object containing information about this invite's origin channel.- Specified by:
getChannel
in interfaceInvite
- Returns:
- Information about this invite's origin channel or null in case of a group invite
- See Also:
-
getCode
Description copied from interface:Invite
The invite code -
getGuild
Description copied from interface:Invite
AnInvite.Guild
object containing information about this invite's origin guild. -
getGroup
Description copied from interface:Invite
AnInvite.Group
object containing information about this invite's origin group. -
getTarget
Description copied from interface:Invite
AnInvite.InviteTarget
object containing information about this invite's target ornull
if this invite does not have a target. -
getInviter
Description copied from interface:Invite
The user who created this invite. For not expanded invites this may be null.- Specified by:
getInviter
in interfaceInvite
- Returns:
- The user who created this invite
-
getJDA
Description copied from interface:Invite
TheJDA
instance used to create this Invite -
getMaxAge
public int getMaxAge()Description copied from interface:Invite
The max age of this invite in seconds.This works only for expanded invites and will throw a
IllegalStateException
otherwise! -
getMaxUses
public int getMaxUses()Description copied from interface:Invite
The max uses of this invite. If there is no limit thus will return0
.This works only for expanded invites and will throw a
IllegalStateException
otherwise!- Specified by:
getMaxUses
in interfaceInvite
- Returns:
- The max uses of this invite or
0
if there is no limit - See Also:
-
getTimeCreated
Description copied from interface:Invite
Returns creation date of this invite.This works only for expanded invites and will throw a
IllegalStateException
otherwise!- Specified by:
getTimeCreated
in interfaceInvite
- Returns:
- The creation date of this invite
- See Also:
-
getUses
public int getUses()Description copied from interface:Invite
How often this invite has been used.This works only for expanded invites and will throw a
IllegalStateException
otherwise! -
isExpanded
public boolean isExpanded()Description copied from interface:Invite
Whether this Invite is expanded or not. Expanded invites contain more information, but they can only be obtained byGuild#retrieveInvites()
(requiresPermission.MANAGE_SERVER
) orIInviteContainer#retrieveInvites()
(requiresPermission.MANAGE_CHANNEL
).There is a convenience method
Invite.expand()
to get the expanded invite for an unexpanded one.- Specified by:
isExpanded
in interfaceInvite
- Returns:
- Whether this invite is expanded or not
- See Also:
-
isTemporary
public boolean isTemporary()Description copied from interface:Invite
Whether this Invite grants only temporary access or not.This works only for expanded invites and will throw a
IllegalStateException
otherwise!- Specified by:
isTemporary
in interfaceInvite
- Returns:
- Whether this invite is temporary or not
- See Also:
-
hashCode
public int hashCode() -
equals
-
toString
-