Class ScheduledEvent

java.lang.Object
discord4j.core.object.entity.ScheduledEvent
All Implemented Interfaces:
DiscordObject, Entity

public class ScheduledEvent extends Object implements Entity
A Discord Guild Scheduled Event
See Also:
  • Constructor Details

    • ScheduledEvent

      public ScheduledEvent(GatewayDiscordClient gateway, discord4j.discordjson.json.GuildScheduledEventData data)
      Constructs a ScheduledEvent with an associated GatewayDiscordClient and Discord data.
      Parameters:
      gateway - The GatewayDiscordClient associated to this object, must be non-null.
      data - The raw data as represented by Discord, must be non-null.
  • Method Details

    • getClient

      public GatewayDiscordClient getClient()
      Description copied from interface: DiscordObject
      Returns the GatewayDiscordClient that created this object. Methods in it are exclusively based on the entity cache or Store in use. Refer to calling getClient().rest() to access a DiscordClient that is capable of requesting entities directly from the REST API.
      Specified by:
      getClient in interface DiscordObject
      Returns:
      The GatewayDiscordClient associated to this object.
    • getId

      public Snowflake getId()
      Description copied from interface: Entity
      Gets the Snowflake that uniquely identifies this entity.
      Specified by:
      getId in interface Entity
      Returns:
      The Snowflake that uniquely identifies this entity.
    • getData

      public discord4j.discordjson.json.GuildScheduledEventData getData()
      Gets the data of the scheduled event.
      Returns:
      The data of the scheduled event.
    • getGuildId

      public Snowflake getGuildId()
      Gets the guild ID of the scheduled event.
      Returns:
      The guild ID of the scheduled event.
    • getCreatorId

      public Optional<Snowflake> getCreatorId()
      Gets the ID of the creator of the event.
      Returns:
      The ID of the creator of the event.
    • getCreator

      public Mono<Member> getCreator()
      Requests to retrieve the creator if this event, if present.
      Returns:
      A Mono where, if the creator is present, emits the creator of the event, otherwise emits an empty mono. If an error is received, it is emitted through the Mono.
    • getChannelId

      public Optional<Snowflake> getChannelId()
      Gets the ID of the channel where the event will be hosted, if present.
      Returns:
      The ID of the channel where the event will be hosted, if present.
    • getChannel

      public Mono<GuildChannel> getChannel()
      Requests to retrieve the channel this event will be hosted in, if present.

      Note: This channel could be a stage or voice channel, see getEntityType() to determine the type safely.

      Returns:
      A Mono where, if the channel is present, emits the channel this event will be hosted in, otherwise emits an empty mono. If an error is received, it is emitted through the Mono.
    • getName

      public String getName()
      Return the name of this scheduled event.
      Returns:
      the scheduled event name
    • getDescription

      public Optional<String> getDescription()
      Return the description of this scheduled event.
      Returns:
      the scheduled event description, if present
    • getStartTime

      public Instant getStartTime()
      Gets the scheduled start time of the event.
      Returns:
      The scheduled start time of the event.
    • getEndTime

      public Optional<Instant> getEndTime()
      Gets the scheduled end time of the event, if present.

      Note: Note: This metadata will always be present when the entity type is external.

      Returns:
      The scheduled end time of the event, if present.
    • getPrivacyLevel

      public ScheduledEvent.PrivacyLevel getPrivacyLevel()
      Gets the privacy level of the event
      Returns:
      The privacy level of the event
    • getStatus

      public ScheduledEvent.Status getStatus()
      Gets the status of the event.
      Returns:
      The status of the event.
    • getImageUrl

      public Optional<String> getImageUrl(Image.Format format)
      Returns the cover image URL of this scheduled event, if present.
      Parameters:
      format - the format for the URL
      Returns:
      the cover image URL, if present.
    • getEntityType

      public ScheduledEvent.EntityType getEntityType()
      Gets the entity type of the event.
      Returns:
      The entity type of the event.
    • getEntityId

      public Optional<Snowflake> getEntityId()
      Gets the ID of the entity this event will be hosted in, if present.

      Note: This property currently matches getChannelId(), it is believed this is available for future flexibility for Discord and should not be relied on.

      Returns:
      The ID of the entity this event will be hosted in, if present.
    • getEntityMetadata

      public Optional<ScheduledEventEntityMetadata> getEntityMetadata()
      Gets the entity metadata of the event, if present.

      Note: This metadata will always be present when the entity type is external.

      Returns:
      The entity metadata of the event, if present.
    • getLocation

      public Optional<String> getLocation()
      Gets the location of the event, if present.

      Note: This location is pulled from ScheduledEventEntityMetadata.getLocation() if present.

      Returns:
      The location of the event, if present.
    • getSubscribedUserCount

      public Optional<Integer> getSubscribedUserCount()
      Gets the count of users who have subscribed to the event, if present.
      Returns:
      The count of users who have subscribed to the event, if present.
    • getSubscribedUsers

      public Flux<ScheduledEventUser> getSubscribedUsers(boolean withMemberData)
      Requests to retrieve the users subscribed to this event.
      Parameters:
      withMemberData - requests to return member data along with user data
      Returns:
      A Flux that continually emits all users after the specified ID. If an error is received, it is emitted through the Flux.
    • getSubscribedUsersBefore

      public Flux<ScheduledEventUser> getSubscribedUsersBefore(Snowflake userId, boolean withMemberData)
      Requests to retrieve the users subscribed to this event
    • before
    • the given user ID.
      Parameters:
      userId - the ID of the
    • newest
    • user to retrieve
      withMemberData - requests to return member data along with user data
      Returns:
      A Flux that continually emits all users after the specified ID. If an error is received, it is emitted through the Flux.
    • getSubscribedUsersAfter

      public Flux<ScheduledEventUser> getSubscribedUsersAfter(Snowflake userId, boolean withMemberData)
      Requests to retrieve the users subscribed to this event
    • after
    • the given user ID.
      Parameters:
      userId - the ID of the
    • oldest
    • user to retrieve
      withMemberData - requests to return member data along with user data
      Returns:
      A Flux that continually emits all users after the specified ID. If an error is received, it is emitted through the Flux.
    • edit

      public discord4j.core.spec.ScheduledEventEditMono edit()
      Requests to edit this scheduled event
      Returns:
      A Mono which, upon completion, emits the new event update. If an error occurs, it is emitted through the Mono.
    • edit

      public Mono<ScheduledEvent> edit(discord4j.core.spec.ScheduledEventEditSpec spec)
      Requests to edit this scheduled event with the provided spec.
      Parameters:
      spec - the parameters to update
      Returns:
      A Mono which, upon completion, emits the new event update. If an error occurs, it is emitted through the Mono.
    • delete

      public Mono<Void> delete(@Nullable String reason)
      Requests to delete this event with the provided reason.
      Parameters:
      reason - the reason explaining why this event is being deleted
      Returns:
      A Mono which completes when the event is deleted.
    • delete

      public Mono<Void> delete()
      Requests to delete this event.
      Returns:
      A Mono which completes when the event is deleted.