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
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumRepresents the status of a scheduled event.static enumRepresents what type of event an event is, or where the event will be taking place at. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTemplate forgetImageUrl()static final StringTemplate forgetJumpUrl().static final intThe maximum allowed length for an event's description.static final intThe maximum allowed length for an event's location.static final intThe maximum allowed length for an event's name. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ScheduledEvent scheduledEvent) Compares twoScheduledEventobjects 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 StringThe ID of the user who originally created this event.longThe 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 ImageProxygetImage()Returns anImageProxyfor this events cover image.The cover image url of the event.intThe amount of users who are interested in attending the event.default JDAgetJDA()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.TheScheduledEventManagerfor this event.getName()The name of the event.The time the event is set to start at.Thestatusof the scheduled event.getType()Thetypeof 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
nullif 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
nullif none is specified
-
getImage
Returns anImageProxyfor this events cover image.- Returns:
- The
ImageProxyfor this events cover image or null if no image is defined - See Also:
-
getCreator
The user who originally created the event.May return
nullif user has deleted their account, theUserobject is not cached or the event was created before Discord started keeping track of event creators on October 21st, 2021.- Returns:
Userobject 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 returnnullif 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
nullif no user is associated with creating this event. - See Also:
-
getStatus
Thestatusof the scheduled event.- Returns:
- The status, or
ScheduledEvent.Status.UNKNOWNif the status is unknown to JDA.
-
getType
Thetypeof the scheduled event.- Returns:
- The type, or
ScheduledEvent.Type.UNKNOWNif 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
nullfor 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_INSTANCEorScheduledEvent.Type.VOICE.- Returns:
- The guild channel, or
nullif 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_INSTANCEandScheduledEvent.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_EVENTSin 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
APaginationActionimplementation that allows toiterateover allMembersinterested 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
ScheduledEventobjects 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
TheScheduledEventManagerfor 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 twoScheduledEventobjects 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:
compareToin interfaceComparable<ScheduledEvent>- Parameters:
scheduledEvent- The provided scheduled event- Returns:
- A negative number if the original event (which is the event that the
compareTomethod 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:
-