Package discord4j.core.object.entity
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:
- Guild Scheduled Event Resource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ScheduledEvent.EntityType
Represents a scheduled event's entity typestatic class
ScheduledEvent.PrivacyLevel
Represents a scheduled event's privacy level.static class
ScheduledEvent.Status
Represents a scheduled event's status
-
Constructor Summary
Constructors Constructor Description ScheduledEvent(GatewayDiscordClient gateway, discord4j.discordjson.json.GuildScheduledEventData data)
Constructs aScheduledEvent
with an associatedGatewayDiscordClient
and Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<Void>
delete()
Requests to delete this event.Mono<Void>
delete(String reason)
Requests to delete this event with the provided reason.discord4j.core.spec.ScheduledEventEditMono
edit()
Requests to edit this scheduled eventMono<ScheduledEvent>
edit(discord4j.core.spec.ScheduledEventEditSpec spec)
Requests to edit this scheduled event with the provided spec.Mono<GuildChannel>
getChannel()
Requests to retrieve the channel this event will be hosted in, if present.Optional<Snowflake>
getChannelId()
Gets the ID of the channel where the event will be hosted, if present.GatewayDiscordClient
getClient()
Returns theGatewayDiscordClient
that created this object.Mono<Member>
getCreator()
Requests to retrieve the creator if this event, if present.Optional<Snowflake>
getCreatorId()
Gets the ID of the creator of the event.discord4j.discordjson.json.GuildScheduledEventData
getData()
Gets the data of the scheduled event.Optional<Instant>
getEndTime()
Gets the scheduled end time of the event, if present.Optional<Snowflake>
getEntityId()
Gets the ID of the entity this event will be hosted in, if present.Optional<ScheduledEventEntityMetadata>
getEntityMetadata()
Gets the entity metadata of the event, if present.ScheduledEvent.EntityType
getEntityType()
Gets the entity type of the event.Snowflake
getGuildId()
Gets the guild ID of the scheduled event.Snowflake
getId()
Gets the Snowflake that uniquely identifies this entity.Optional<String>
getLocation()
Gets the location of the event, if present.ScheduledEvent.PrivacyLevel
getPrivacyLevel()
Gets the privacy level of the eventInstant
getStartTime()
Gets the scheduled start time of the event.ScheduledEvent.Status
getStatus()
Gets the status of the event.Optional<Integer>
getSubscribedUserCount()
Gets the count of users who have subscribed to the event, if present.Flux<ScheduledEventUser>
getSubscribedUsers(boolean withMemberData)
Requests to retrieve the users subscribed to this event.Flux<ScheduledEventUser>
getSubscribedUsersAfter(Snowflake userId, boolean withMemberData)
Requests to retrieve the users subscribed to this event after the given user ID.Flux<ScheduledEventUser>
getSubscribedUsersBefore(Snowflake userId, boolean withMemberData)
Requests to retrieve the users subscribed to this event before the given user ID.
-
-
-
Constructor Detail
-
ScheduledEvent
public ScheduledEvent(GatewayDiscordClient gateway, discord4j.discordjson.json.GuildScheduledEventData data)
Constructs aScheduledEvent
with an associatedGatewayDiscordClient
and Discord data.- Parameters:
gateway
- TheGatewayDiscordClient
associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.
-
-
Method Detail
-
getClient
public GatewayDiscordClient getClient()
Description copied from interface:DiscordObject
Returns theGatewayDiscordClient
that created this object. Methods in it are exclusively based on the entity cache orStore
in use. Refer to callinggetClient().rest()
to access aDiscordClient
that is capable of requesting entities directly from the REST API.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The
GatewayDiscordClient
associated to this object.
-
getId
public Snowflake getId()
Description copied from interface:Entity
Gets 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 thecreator
of the event, otherwise emits anempty mono
. If an error is received, it is emitted through theMono
.
-
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 thechannel
this event will be hosted in, otherwise emits anempty mono
. If an error is received, it is emitted through theMono
.
-
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.
-
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.
-
getSubscribedUsersBefore
public Flux<ScheduledEventUser> getSubscribedUsersBefore(Snowflake userId, boolean withMemberData)
Requests to retrieve the users subscribed to this event- before
the given user ID.
-
getSubscribedUsersAfter
public Flux<ScheduledEventUser> getSubscribedUsersAfter(Snowflake userId, boolean withMemberData)
Requests to retrieve the users subscribed to this event- after
the given user ID.
-
edit
public discord4j.core.spec.ScheduledEventEditMono edit()
Requests to edit this scheduled event
-
edit
public Mono<ScheduledEvent> edit(discord4j.core.spec.ScheduledEventEditSpec spec)
Requests to edit this scheduled event with the provided spec.
-
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.
-
-