public interface Invite
Modifier and Type | Interface and Description |
---|---|
static interface |
Invite.Channel
POJO for the channel information provided by an invite.
|
static interface |
Invite.Guild
POJO for the guild information provided by an invite.
|
Modifier and Type | Method and Description |
---|---|
RestAction<Invite> |
accept()
Accepts this invite and joins the guild.
|
RestAction<Invite> |
delete()
Deletes this invite.
|
RestAction<Invite> |
expand()
Tries to retrieve a new expanded
Invite with more info. |
Invite.Channel |
getChannel()
An
Invite.Channel object
containing information about this invite's origin channel. |
java.lang.String |
getCode()
The invite code
|
java.time.OffsetDateTime |
getCreationTime()
Returns creation date of this invite.
|
Invite.Guild |
getGuild()
An
Invite.Guild object
containing information about this invite's origin guild. |
User |
getInviter()
The user who created this invite.
|
JDA |
getJDA()
The
JDA instance used to create this Invite |
int |
getMaxAge()
The max age of this invite in seconds.
|
int |
getMaxUses()
The max uses of this invite.
|
int |
getUses()
How often this invite has been used.
|
boolean |
isExpanded()
Whether this Invite is expanded or not.
|
boolean |
isTemporary()
Whether this Invite grants only temporary access or not
|
static RestAction<Invite> |
resolve(JDA api,
java.lang.String code)
Retrieves a new
Invite instance for the given invite code. |
static RestAction<Invite> resolve(JDA api, java.lang.String code)
Invite
instance for the given invite code.
Possible ErrorResponses
include:
Unknown Invite
api
- The JDA instancecode
- A valid invite codeRestAction
- Type: Invite
RestAction<Invite> accept()
Possible ErrorResponses
include:
Unknown Invite
RestAction
- Type: Invite
AccountTypeException
- if the currently logged in account is not from AccountType#CLIENT
JDAClient.acceptInvite(Invite)
RestAction<Invite> delete()
MANAGE_CHANNEL
in the invite's channel.
Will throw a PermissionException
otherwise.RestAction
- Type: Invite
PermissionException
- if the account does not have MANAGE_SERVER
in the invite's channelRestAction<Invite> expand()
Invite
with more info.
MANAGE_SERVER
in the invite's guild or
MANAGE_CHANNEL
in the invite's channel.
Will throw a PermissionException
otherwise.RestAction
- Type: Invite
PermissionException
- if the account neither has MANAGE_SERVER
in the invite's guild nor
MANAGE_CHANNEL
in the invite's channelisExpanded()
Invite.Channel getChannel()
Invite.Channel
object
containing information about this invite's origin channel.Invite.Channel
java.lang.String getCode()
java.time.OffsetDateTime getCreationTime()
This works only for expanded invites and will throw a IllegalStateException
otherwise!
java.lang.IllegalStateException
- if this invite is not expandedexpand()
,
isExpanded()
Invite.Guild getGuild()
Invite.Guild
object
containing information about this invite's origin guild.Invite.Guild
User getInviter()
This works only for expanded invites and will throw a IllegalStateException
otherwise!
java.lang.IllegalStateException
- if this invite is not expandedexpand()
,
isExpanded()
JDA getJDA()
JDA
instance used to create this Inviteint getMaxAge()
This works only for expanded invites and will throw a IllegalStateException
otherwise!
java.lang.IllegalStateException
- if this invite is not expandedexpand()
,
isExpanded()
int getMaxUses()
0
.
This works only for expanded invites and will throw a IllegalStateException
otherwise!
0
if there is no limitjava.lang.IllegalStateException
- if this invite is not expandedexpand()
,
isExpanded()
int getUses()
This works only for expanded invites and will throw a IllegalStateException
otherwise!
java.lang.IllegalStateException
- if this invite is not expandedexpand()
,
isExpanded()
boolean isExpanded()
Guild#getInvites()
(requires
Permission.MANAGE_CHANNEL
) or
Channel#getInvites()
(requires
Permission.MANAGE_SERVER
).
There is a convenience method expand()
to get the expanded invite for an unexpanded one.
expand()
boolean isTemporary()
java.lang.IllegalStateException
- if this invite is not expanded