public interface Invite
Modifier and Type | Interface | Description |
---|---|---|
static interface |
Invite.Channel |
POJO for the channel information provided by an invite.
|
static interface |
Invite.Group |
POJO for the group information provided by an invite.
|
static interface |
Invite.Guild |
POJO for the guild information provided by an invite.
|
static class |
Invite.InviteType |
Enum representing the type of an invite.
|
Modifier and Type | Method | Description |
---|---|---|
AuditableRestAction<java.lang.Void> |
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.Group |
getGroup() |
An
Invite.Group object
containing information about this invite's origin group. |
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.
|
Invite.InviteType |
getType() |
The type of this invite.
|
default java.lang.String |
getURL() |
The invite URL for this invite in the format of:
"https://discord.gg/" + getCode() |
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,
boolean withCounts) |
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
static RestAction<Invite> resolve(JDA api, java.lang.String code, boolean withCounts)
Invite
instance for the given invite code.
Possible ErrorResponses
include:
Unknown Invite
api
- The JDA instancecode
- A valid invite codewithCounts
- Whether or not to include online and member counts for guild invites or users for group invitesRestAction
- Type: Invite
@CheckReturnValue AuditableRestAction<java.lang.Void> delete()
MANAGE_CHANNEL
in the invite's channel.
Will throw a InsufficientPermissionException
otherwise.AuditableRestAction
InsufficientPermissionException
- if the account does not have MANAGE_SERVER
in the invite's channel@CheckReturnValue RestAction<Invite> expand()
Invite
with more info.
IllegalStateException
for other types.
MANAGE_SERVER
in the invite's guild or
MANAGE_CHANNEL
in the invite's channel.
Will throw a InsufficientPermissionException
otherwise.RestAction
- Type: Invite
InsufficientPermissionException
- if the account neither has MANAGE_SERVER
in the invite's guild nor
MANAGE_CHANNEL
in the invite's channeljava.lang.IllegalStateException
- If this is a group invitegetType()
,
isExpanded()
Invite.InviteType getType()
Invite.Channel getChannel()
Invite.Channel
object
containing information about this invite's origin channel.Invite.Channel
java.lang.String getCode()
Invite.Group getGroup()
Invite.Group
object
containing information about this invite's origin group.Invite.Group
default java.lang.String getURL()
"https://discord.gg/" + 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()
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