Interface ScheduledEvent
- All Superinterfaces:
Comparable<ScheduledEvent>
,ISnowflake
ScheduledEvent
(The events that show up under the events tab in the Official Discord Client).
These events should not be confused with Gateway Events
,
which are fired by Discord whenever something interesting happens
(ie., a MessageDeleteEvent
gets fired whenever a message gets deleted).-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Represents the status of a scheduled event.static enum
Represents what type of event an event is, or where the event will be taking place at. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Template forgetImageUrl()
static final String
Template forgetJumpUrl()
.static final int
The maximum allowed length for an event's description.static final int
The maximum allowed length for an event's location.static final int
The maximum allowed length for an event's name. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(ScheduledEvent scheduledEvent) Compares twoScheduledEvent
objects based on their scheduled start times.delete()
Deletes this Scheduled Event.The guild channel the event is set to take place in.The user who originally created the event.default String
The ID of the user who originally created this event.long
The ID of the user who originally created this event.The description of the event.The time the event is set to end at.getGuild()
The guild that this event was created indefault ImageProxy
getImage()
Returns anImageProxy
for this events cover image.The cover image url of the event.int
The amount of users who are interested in attending the event.default JDA
getJDA()
The JDA instance associated with this event objectReturns the jump-to URL of the event.The location the event is set to take place in.TheScheduledEventManager
for this event.getName()
The name of the event.The time the event is set to start at.Thestatus
of the scheduled event.getType()
Thetype
of the scheduled event.Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Field Details
-
JUMP_URL
Template forgetJumpUrl()
. Args: .../guild_id/event_id- See Also:
-
MAX_NAME_LENGTH
static final int MAX_NAME_LENGTHThe maximum allowed length for an event's name.- See Also:
-
MAX_DESCRIPTION_LENGTH
static final int MAX_DESCRIPTION_LENGTHThe maximum allowed length for an event's description.- See Also:
-
MAX_LOCATION_LENGTH
static final int MAX_LOCATION_LENGTHThe maximum allowed length for an event's location.- See Also:
-
IMAGE_URL
Template forgetImageUrl()
- See Also:
-
-
Method Details
-
getName
The name of the event.- Returns:
- The event's name
-
getDescription
The description of the event.- Returns:
- The description, or
null
if none is specified
-
getImageUrl
The cover image url of the event.Links to a potentially heavily compressed image. You can append a size parameter to the URL if needed. Example:
?size=4096
- Returns:
- The image url, or
null
if none is specified
-
getImage
Returns anImageProxy
for this events cover image.- Returns:
- The
ImageProxy
for this events cover image or null if no image is defined - See Also:
-
getCreator
The user who originally created the event.May return
null
if user has deleted their account, theUser
object is not cached or the event was created before Discord started keeping track of event creators on October 21st, 2021.- Returns:
User
object representing the event's creator ornull
.- See Also:
-
getCreatorIdLong
long getCreatorIdLong()The ID of the user who originally created this event.This method may return 0 if the event was created before Discord started keeping track of event creators on October 21st, 2021.
- Returns:
- The ID of the user who created this event, or 0 if no user is associated with creating this event.
- See Also:
-
getCreatorId
The ID of the user who originally created this event.
This method may returnnull
if the event was created before Discord started keeping track of event creators on October 21st, 2021.- Returns:
- The Id of the user who created this event, or
null
if no user is associated with creating this event. - See Also:
-
getStatus
Thestatus
of the scheduled event.- Returns:
- The status, or
ScheduledEvent.Status.UNKNOWN
if the status is unknown to JDA.
-
getType
Thetype
of the scheduled event.- Returns:
- The type, or
ScheduledEvent.Type.UNKNOWN
if the type is unknown to JDA.
-
getStartTime
The time the event is set to start at.- Returns:
- The time the event is set to start at
- See Also:
-
getEndTime
The time the event is set to end at.
The end time is only required for external events, which are events that are not associated with a stage or voice channel.- Returns:
- The time the event is set to end at. This can't be
null
for events ofScheduledEvent.Type.EXTERNAL
, but can be null for other types. - See Also:
-
getChannel
The guild channel the event is set to take place in.
Note that this method is only applicable to events which are not ofScheduledEvent.Type.STAGE_INSTANCE
orScheduledEvent.Type.VOICE
.- Returns:
- The guild channel, or
null
if the guild channel was deleted or if the event is ofScheduledEvent.Type.EXTERNAL
- See Also:
-
getLocation
The location the event is set to take place in. This will return the channel id forScheduledEvent.Type.STAGE_INSTANCE
andScheduledEvent.Type.VOICE
.- Returns:
- The channel id or the external location of the event
- See Also:
-
getJumpUrl
Returns the jump-to URL of the event. Clicking this URL in the Discord client will open the event.- Returns:
- A String representing the jump-to URL of the event.
-
delete
Deletes this Scheduled Event.Possible ErrorResponses include:
UNKNOWN_SCHEDULED_EVENT
If the the event was already deleted.MISSING_PERMISSIONS
The send request was attempted after the account lostPermission.MANAGE_EVENTS
in the guild.MISSING_ACCESS
If we were removed from the Guild
- Returns:
AuditableRestAction
- Throws:
InsufficientPermissionException
- If we don't have the permission toMANAGE_EVENTS
-
retrieveInterestedMembers
APaginationAction
implementation that allows toiterate
over allMembers
interested in this Event.
This iterates in ascending order by member id.Possible ErrorResponses include:
ErrorResponse.UNKNOWN_SCHEDULED_EVENT
If the the event was already deleted.MISSING_ACCESS
If we were removed from the Guild or can't view the events channel (Location)
-
getInterestedUserCount
int getInterestedUserCount()The amount of users who are interested in attending the event.This method only returns the cached count, and may not be consistent with the live count. Discord may additionally not provide an interested user count for some
ScheduledEvent
objects returned from the Guild's or JDA's cache, and this method may return -1 as a result. However, event's retrieved usingGuild.retrieveScheduledEventById(long)
will always contain an interested user count.- Returns:
- The amount of users who are interested in attending the event
- See Also:
-
getGuild
The guild that this event was created in- Returns:
- The guild
-
getJDA
The JDA instance associated with this event object- Returns:
- The JDA instance
-
getManager
TheScheduledEventManager
for this event.
In the ScheduledEventManager, you can modify all values and also start, end, or cancel events.
You can modify multiple fields in one request by chaining setters before callingRestAction.queue()
.- Returns:
- The ScheduledEventManager of this event
- Throws:
InsufficientPermissionException
- If the currently logged in account does not havePermission.MANAGE_EVENTS
-
compareTo
Compares twoScheduledEvent
objects based on their scheduled start times.
If two events are set to start at the same time, the comparison will be made based on their snowflake ID.- Specified by:
compareTo
in interfaceComparable<ScheduledEvent>
- Parameters:
scheduledEvent
- The provided scheduled event- Returns:
- A negative number if the original event (which is the event that the
compareTo
method is called upon) starts sooner than the provided event, or positive if it will start later than the provided event. If both events are set to start at the same time, then the result will be negative if the original event's snowflake ID is less than the provided event's ID, positive if it is greater than, or 0 if they are the same. - Throws:
IllegalArgumentException
- If the provided scheduled event isnull
, from a differentGuild
, or is not a valid scheduled event provided by JDA.- See Also:
-