Class GatewayDiscordClient
- java.lang.Object
-
- discord4j.core.GatewayDiscordClient
-
- All Implemented Interfaces:
EntityRetriever
public class GatewayDiscordClient extends Object implements EntityRetriever
An aggregation of all dependencies Discord4J requires to operate with the Discord Gateway, REST API and Voice Gateway. Maintains a set of connections to every shard logged in from the sameGatewayBootstrap
and therefore tracks state updates from all connected shards.The following are some resources available through this aggregate:
- Access to the base
DiscordClient
for direct REST API operations throughrest()
. - Access to
CoreResources
like theRestClient
used to perform API requests. - Access to
GatewayResources
that configure Gateway stores, actions and coordination among shards. - Access to
EventDispatcher
publishing events from all participating shards.
-
-
Constructor Summary
Constructors Constructor Description GatewayDiscordClient(DiscordClient discordClient, GatewayResources gatewayResources, Mono<Void> onDisconnect, GatewayClientGroup gatewayClientGroup, VoiceConnectionFactory voiceConnectionFactory, EntityRetrievalStrategy entityRetrievalStrategy, Set<String> completingChunkNonces)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Mono<Guild>
createGuild(discord4j.core.spec.GuildCreateSpec spec)
Requests to create a guild.discord4j.core.spec.GuildCreateMono
createGuild(String name, Region region)
Requests to create a guild.Mono<Guild>
createGuild(Consumer<? super LegacyGuildCreateSpec> spec)
Deprecated.usecreateGuild(GuildCreateSpec)
orcreateGuild(String, Region)
which offer an immutable approach to build specsdiscord4j.core.spec.UserEditMono
edit()
Requests to edit this client (i.e., modify the current bot user).Mono<User>
edit(discord4j.core.spec.UserEditSpec spec)
Requests to edit this client (i.e., modify the current bot user).Mono<User>
edit(Consumer<? super LegacyUserEditSpec> spec)
Deprecated.useedit(UserEditSpec)
oredit()
which offer an immutable approach to build specsMono<ApplicationInfo>
getApplicationInfo()
Requests to retrieve the application info.Mono<Channel>
getChannelById(Snowflake channelId)
Requests to retrieve the channel represented by the supplied ID.CoreResources
getCoreResources()
Returns the set of resources essential to operate on aDiscordClient
for entity manipulation, scheduling and API communication, like theRestClient
,JacksonResources
andReactorResources
.EventDispatcher
getEventDispatcher()
Distributes events to subscribers.Optional<GatewayClient>
getGatewayClient(int shardId)
Returns aGatewayClient
instance created by thisGatewayDiscordClient
, which is associated to a given shard index.GatewayClientGroup
getGatewayClientGroup()
Returns theGatewayClientGroup
capable of performing operations across allGatewayClient
instances created or managed by thisGatewayDiscordClient
.GatewayResources
getGatewayResources()
Returns the set of resources essential to buildGatewayClient
instances and manage multiple Discord Gateway connections.Flux<AutoModRule>
getGuildAutoModRules(Snowflake guildId)
Requests to retrieve the guild's automod rules.Mono<Guild>
getGuildById(Snowflake guildId)
Requests to retrieve the guild represented by the supplied ID.Flux<GuildChannel>
getGuildChannels(Snowflake guildId)
Requests to retrieve the guild's channels.Mono<GuildEmoji>
getGuildEmojiById(Snowflake guildId, Snowflake emojiId)
Requests to retrieve the guild emoji represented by the supplied IDs.Flux<GuildEmoji>
getGuildEmojis(Snowflake guildId)
Requests to retrieve the guild's emojis.Flux<Member>
getGuildMembers(Snowflake guildId)
Requests to retrieve the guild's members.Flux<Role>
getGuildRoles(Snowflake guildId)
Requests to retrieve the guild's roles.Flux<Guild>
getGuilds()
Requests to retrieve the guilds the current client is in.Mono<GuildSticker>
getGuildStickerById(Snowflake guildId, Snowflake stickerId)
Requests to retrieve the guild sticker represented by the supplied IDs.Flux<GuildSticker>
getGuildStickers(Snowflake guildId)
Requests to retrieve the guild's stickers.Mono<Invite>
getInvite(String inviteCode)
Requests to retrieve an invite.Mono<Invite>
getInvite(String inviteCode, boolean withCounts, boolean withExpiration, Snowflake guildScheduledEventId)
Requests to retrieve an invite.Mono<Member>
getMemberById(Snowflake guildId, Snowflake userId)
Requests to retrieve the member represented by the supplied IDs.Mono<Message>
getMessageById(Snowflake channelId, Snowflake messageId)
Requests to retrieve the message represented by the supplied IDs.Flux<Region>
getRegions()
Requests to retrieve the voice regions that are available.RestClient
getRestClient()
Returns theRestClient
used to execute REST API requests.Mono<Role>
getRoleById(Snowflake guildId, Snowflake roleId)
Requests to retrieve the role represented by the supplied IDs.Mono<ScheduledEvent>
getScheduledEventById(Snowflake guildId, Snowflake eventId)
Requests to retrieve theScheduledEvent
represented by the supplied IDs.Flux<ScheduledEvent>
getScheduledEvents(Snowflake guildId)
Requests to retrieve the guild's scheduled events.Flux<ScheduledEventUser>
getScheduledEventUsers(Snowflake guildId, Snowflake eventId)
Requests to retrieve the users that subscribed to the event represented by the supplied IDs.Mono<User>
getSelf()
Requests to retrieve the bot user.Snowflake
getSelfId()
Gets the bot user's ID.Mono<Member>
getSelfMember(Snowflake guildId)
Requests to retrieve the bot user represented as amember
of the guild with the supplied ID.Mono<GuildTemplate>
getTemplateByCode(String templateCode)
Requests to retrieve the template represented by the supplied code.Mono<User>
getUserById(Snowflake userId)
Requests to retrieve the user represented by the supplied ID.Flux<User>
getUsers()
Retrieve the currently stored (cached) users.VoiceConnectionFactory
getVoiceConnectionFactory()
Returns theVoiceConnectionFactory
instance created by thisGatewayDiscordClient
.VoiceConnectionRegistry
getVoiceConnectionRegistry()
Return theVoiceConnectionRegistry
for thisGatewayDiscordClient
.Mono<Webhook>
getWebhookById(Snowflake webhookId)
Requests to retrieve the webhook represented by the supplied ID.Mono<Webhook>
getWebhookByIdWithToken(Snowflake webhookId, String token)
Requests to retrieve the webhook represented by the supplied ID and token.Mono<Void>
logout()
Disconnects thisGatewayDiscordClient
from Discord upon subscribing.Flux<Event>
on(ReactiveEventAdapter adapter)
Applies a givenadapter
to all events from this dispatcher.<E extends Event>
Flux<E>on(Class<E> eventClass)
<E extends Event,T>
Flux<T>on(Class<E> eventClass, Function<E,Publisher<T>> mapper)
Mono<Void>
onDisconnect()
Return aMono
that signals completion when allGatewayClient
instances in this shard group have disconnected.Flux<discord4j.discordjson.json.gateway.GuildMembersChunk>
requestMemberChunks(discord4j.discordjson.json.gateway.RequestGuildMembers request)
Submit aRequestGuildMembers
payload using the current Gateway connection and wait for its completion, delivering rawGuildMembersChunk
elements asynchronously through aFlux
.Flux<Member>
requestMembers(Snowflake guildId)
Flux<Member>
requestMembers(Snowflake guildId, Set<Snowflake> userIds)
Flux<Member>
requestMembers(discord4j.discordjson.json.gateway.RequestGuildMembers request)
DiscordClient
rest()
Access the parentDiscordClient
capable of performing direct REST API requests and REST entities.Mono<Void>
updatePresence(ClientPresence clientPresence)
Update the bot'sClientPresence
(client status) for every shard in this shard group.Mono<Void>
updatePresence(ClientPresence clientPresence, int shardId)
Update the bot'sPresence
(status) for the given shard index, provided it belongs in this shard group.EntityRetriever
withRetrievalStrategy(EntityRetrievalStrategy retrievalStrategy)
Applies the given strategy to retrieve entities using thisGatewayDiscordClient
.
-
-
-
Constructor Detail
-
GatewayDiscordClient
public GatewayDiscordClient(DiscordClient discordClient, GatewayResources gatewayResources, Mono<Void> onDisconnect, GatewayClientGroup gatewayClientGroup, VoiceConnectionFactory voiceConnectionFactory, EntityRetrievalStrategy entityRetrievalStrategy, Set<String> completingChunkNonces)
-
-
Method Detail
-
rest
public DiscordClient rest()
Access the parentDiscordClient
capable of performing direct REST API requests and REST entities.- Returns:
- the
DiscordClient
that created thisGatewayDiscordClient
-
getCoreResources
public CoreResources getCoreResources()
Returns the set of resources essential to operate on aDiscordClient
for entity manipulation, scheduling and API communication, like theRestClient
,JacksonResources
andReactorResources
.- Returns:
- the
RestResources
for the parentDiscordClient
-
getGatewayResources
public GatewayResources getGatewayResources()
Returns the set of resources essential to buildGatewayClient
instances and manage multiple Discord Gateway connections.- Returns:
- the
GatewayResources
tied to thisGatewayDiscordClient
-
getEventDispatcher
public EventDispatcher getEventDispatcher()
Distributes events to subscribers. Starting from v3.1, theEventDispatcher
is capable of distributing events from allGatewayClient
connections (shards) that were specified when thisGatewayDiscordClient
was created.- Returns:
- the
EventDispatcher
tied to thisGatewayDiscordClient
-
getGatewayClient
public Optional<GatewayClient> getGatewayClient(int shardId)
Returns aGatewayClient
instance created by thisGatewayDiscordClient
, which is associated to a given shard index.- Parameters:
shardId
- the shard index used to get the client instance- Returns:
- a
GatewayClient
instance represented by the given shard, if present
-
getGatewayClientGroup
public GatewayClientGroup getGatewayClientGroup()
Returns theGatewayClientGroup
capable of performing operations across allGatewayClient
instances created or managed by thisGatewayDiscordClient
.- Returns:
- a
GatewayClientGroup
to aggregate gateway operations
-
getVoiceConnectionFactory
public VoiceConnectionFactory getVoiceConnectionFactory()
Returns theVoiceConnectionFactory
instance created by thisGatewayDiscordClient
.- Returns:
- a
VoiceConnectionFactory
instance capable of initiating voice connections
-
getVoiceConnectionRegistry
public VoiceConnectionRegistry getVoiceConnectionRegistry()
Return theVoiceConnectionRegistry
for thisGatewayDiscordClient
. This allows you to retrieve currently registeredVoiceConnection
instances.- Returns:
- a
VoiceConnectionRegistry
for voice connections
-
getRestClient
public RestClient getRestClient()
Returns theRestClient
used to execute REST API requests.- Returns:
- the
RestClient
tied to this Gateway client.
-
getWebhookById
public Mono<Webhook> getWebhookById(Snowflake webhookId)
Requests to retrieve the webhook represented by the supplied ID. The bot must have the MANAGE_WEBHOOKS permission in the webhook's channel.
-
getWebhookByIdWithToken
public Mono<Webhook> getWebhookByIdWithToken(Snowflake webhookId, String token)
Requests to retrieve the webhook represented by the supplied ID and token. Doesn't return the user who created the webhook object. Doesn't require the bot to have the MANAGE_WEBHOOKS permission.- Parameters:
webhookId
- The ID of the webhook.token
- The authentication token of the webhook.- Returns:
- A
Mono
where, upon successful completion, emits theWebhook
as represented by the supplied ID without the user field and with the token field. If an error is received, it is emitted through theMono
.
-
getApplicationInfo
public Mono<ApplicationInfo> getApplicationInfo()
Requests to retrieve the application info.- Returns:
- A
Mono
where, upon successful completion, emits theapplication info
. If an error is received, it is emitted through theMono
.
-
getRegions
public Flux<Region> getRegions()
Requests to retrieve the voice regions that are available.
-
getTemplateByCode
public Mono<GuildTemplate> getTemplateByCode(String templateCode)
Requests to retrieve the template represented by the supplied code.- Parameters:
templateCode
- The code of the template.- Returns:
- A
Mono
where, upon successful completion, emits theGuildTemplate
as represented by the supplied code. If an error is received, it is emitted through theMono
.
-
getSelfId
public Snowflake getSelfId()
Gets the bot user's ID.- Returns:
- The bot user's ID.
-
createGuild
@Deprecated public Mono<Guild> createGuild(Consumer<? super LegacyGuildCreateSpec> spec)
Deprecated.usecreateGuild(GuildCreateSpec)
orcreateGuild(String, Region)
which offer an immutable approach to build specsRequests to create a guild.- Parameters:
spec
- AConsumer
that provides a "blank"LegacyGuildCreateSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the createdGuild
. If an error is received, it is emitted through theMono
.
-
createGuild
public discord4j.core.spec.GuildCreateMono createGuild(String name, Region region)
Requests to create a guild. Properties specifying how to create the guild can be set via thewithXxx
methods of the returnedGuildCreateMono
.- Parameters:
name
- the name of the guild to createregion
- the region of the guild to create- Returns:
- A
GuildCreateMono
where, upon successful completion, emits the createdGuild
. If an error is received, it is emitted through theGuildCreateMono
.
-
createGuild
public Mono<Guild> createGuild(discord4j.core.spec.GuildCreateSpec spec)
Requests to create a guild.
-
updatePresence
public Mono<Void> updatePresence(ClientPresence clientPresence)
Update the bot'sClientPresence
(client status) for every shard in this shard group.- Parameters:
clientPresence
- The updated client status.- Returns:
- A
Mono
that signals completion upon successful update. If an error is received, it is emitted through theMono
.
-
updatePresence
public Mono<Void> updatePresence(ClientPresence clientPresence, int shardId)
Update the bot'sPresence
(status) for the given shard index, provided it belongs in this shard group.- Parameters:
clientPresence
- The updated client presence.- Returns:
- A
Mono
that signals completion upon successful update. If an error is received, it is emitted through theMono
.
-
getInvite
public Mono<Invite> getInvite(String inviteCode, boolean withCounts, boolean withExpiration, @Nullable Snowflake guildScheduledEventId)
Requests to retrieve an invite.- Parameters:
inviteCode
- the code for the invite (e.g. "xdYkpp").withCounts
- whether the invite should contain approximate member countswithExpiration
- whether the invite should contain the expiration dateguildScheduledEventId
- the guild scheduled event to include with the invite, can benull
- Returns:
- A
Mono
where, upon successful completion, emits theInvite
as represented by the supplied invite code. If an error is received, it is emitted through theMono
.
-
edit
@Deprecated public Mono<User> edit(Consumer<? super LegacyUserEditSpec> spec)
Deprecated.useedit(UserEditSpec)
oredit()
which offer an immutable approach to build specsRequests to edit this client (i.e., modify the current bot user).- Parameters:
spec
- AConsumer
that provides a "blank"LegacyUserEditSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the editedUser
. If an error is received, it is emitted through theMono
.
-
edit
public discord4j.core.spec.UserEditMono edit()
Requests to edit this client (i.e., modify the current bot user). Properties specifying how to edit this client can be set via thewithXxx
methods of the returnedUserEditMono
.
-
edit
public Mono<User> edit(discord4j.core.spec.UserEditSpec spec)
Requests to edit this client (i.e., modify the current bot user).
-
logout
public Mono<Void> logout()
Disconnects thisGatewayDiscordClient
from Discord upon subscribing. AllGatewayClient
instances in this shard group will attempt to close their current Gateway session and complete thisMono
after all of them have disconnected.- Returns:
- A
Mono
that upon subscription, will disconnect each Gateway connection established by thisGatewayDiscordClient
and complete after all of them have closed.
-
onDisconnect
public Mono<Void> onDisconnect()
Return aMono
that signals completion when allGatewayClient
instances in this shard group have disconnected.- Returns:
- a
Mono
that will complete once allGatewayClient
instances in this shard group have disconnected.
-
on
public <E extends Event> Flux<E> on(Class<E> eventClass)
Retrieves aFlux
with elements of the givenEvent
type. ThisFlux
has to be subscribed to in order to start processing. SeeEvent
class for the list of possible event classes.Note: Errors occurring while processing events will terminate your sequence. If you wish to use a version capable of handling errors for you, use
on(Class, Function)
. See Reactive Streams Spec explaining this behavior.A recommended pattern to use this method is wrapping your code that may throw exceptions within a
flatMap
block and useMono.onErrorResume(Function)
,Flux.onErrorResume(Function)
or equivalent methods to maintain the sequence active:client.on(MessageCreateEvent.class) .flatMap(event -> myCodeThatMightThrow(event) .onErrorResume(error -> { // log and then discard the error to keep the sequence alive log.error("Failed to handle event!", error); return Mono.empty(); })) .subscribe();
For more alternatives to handling errors, please see Error Handling docs page.
- Type Parameters:
E
- the type of the event class- Parameters:
eventClass
- the event class to obtain events from- Returns:
- a new
Flux
with the requested events
-
on
public <E extends Event,T> Flux<T> on(Class<E> eventClass, Function<E,Publisher<T>> mapper)
Retrieves aFlux
with elements of the givenEvent
type, to be processed through a givenFunction
upon subscription. Errors occurring within the mapper will be logged and discarded, preventing the termination of the "infinite" event sequence. SeeEvent
class for the list of possible event classes.There are multiple ways of using this event handling method, for example:
client.on(MessageCreateEvent.class, event -> { // myCodeThatMightThrow should return a Reactor type (Mono or Flux) return myCodeThatMightThrow(event); }) .subscribe(); client.on(MessageCreateEvent.class, event -> { // myCodeThatMightThrow *can* be blocking, so wrap it in a Reactor type return Mono.fromRunnable(() -> myCodeThatMightThrow(event)); }) .subscribe();
Continuing the chain after
on(class, event -> ...)
will require your own error handling strategy. Check the docs foron(Class)
for more details.- Type Parameters:
E
- the type of the event classT
- the type of the event mapper function- Parameters:
eventClass
- the event class to obtain events frommapper
- an event mapping function called on each event. If you do not wish to perform further operations you can returnMono.empty()
.- Returns:
- a new
Flux
with the type resulting from the given event mapper
-
on
public Flux<Event> on(ReactiveEventAdapter adapter)
Applies a givenadapter
to all events from this dispatcher. Errors occurring within the mapper will be logged and discarded, preventing the termination of the "infinite" event sequence. This variant allows you to have a single subscriber to this dispatcher, which is useful to collect all startup events.A standard approach to this method is to subclass
ReactiveEventAdapter
, overriding the methods you want to listen for:client.on(new ReactiveEventAdapter() { public Publisher<?> onReady(ReadyEvent event) { return Mono.fromRunnable(() -> System.out.println("Connected as " + event.getSelf().getTag())); } public Publisher<?> onMessageCreate(MessageCreateEvent event) { if (event.getMessage().getContent().equals("!ping")) { return event.getMessage().getChannel() .flatMap(channel -> channel.createMessage("Pong!")); } return Mono.empty(); } }).subscribe(); // nothing happens until you subscribe
Each method requires a
Publisher
return likeMono
orFlux
and all errors will be logged and discarded. To use a synchronous implementation you can wrap your code withMono.fromRunnable(Runnable)
.Continuing the chain will require your own error handling strategy. Check the docs for
on(Class)
for more details.- Parameters:
adapter
- an adapter meant to be subclassed with its appropriate methods overridden- Returns:
- a new
Flux
with the type resulting from the given event mapper
-
requestMembers
public Flux<Member> requestMembers(Snowflake guildId)
Return allmembers
from the givenguildId
using the current Gateway connection. This method performs a check to validate whether the given guild's data can be obtained from thisGatewayDiscordClient
.
-
requestMembers
public Flux<Member> requestMembers(Snowflake guildId, Set<Snowflake> userIds)
Return a set ofmembers
from the givenguildId
using the current Gateway connection. This method performs a check to validate whether the given guild's data can be obtained from thisGatewayDiscordClient
.
-
requestMembers
public Flux<Member> requestMembers(discord4j.discordjson.json.gateway.RequestGuildMembers request)
Submit aRequestGuildMembers
payload using the current Gateway connection and wait for its completion, deliveringMember
elements asynchronously through aFlux
. This method performs a check to validate whether the given guild's data can be obtained from thisGatewayDiscordClient
.
-
requestMemberChunks
public Flux<discord4j.discordjson.json.gateway.GuildMembersChunk> requestMemberChunks(discord4j.discordjson.json.gateway.RequestGuildMembers request)
Submit aRequestGuildMembers
payload using the current Gateway connection and wait for its completion, delivering rawGuildMembersChunk
elements asynchronously through aFlux
. This method performs a check to validate whether the given guild's data can be obtained from thisGatewayDiscordClient
.A timeout given by is used to fail this request if the operation is unable to complete due to disallowed or disabled members intent. This is particularly relevant when requesting a complete member list. If the timeout is triggered, a
TimeoutException
is forwarded through theFlux
.- Parameters:
request
- the member request to submit. Create one usingRequestGuildMembers.builder()
.Flux.timeout(Duration)
- Returns:
- a
Flux
ofGuildMembersChunk
for the givenGuild
. If an error occurs, it is emitted through theFlux
.
-
withRetrievalStrategy
public EntityRetriever withRetrievalStrategy(EntityRetrievalStrategy retrievalStrategy)
Applies the given strategy to retrieve entities using thisGatewayDiscordClient
.- Parameters:
retrievalStrategy
- the strategy to apply- Returns:
- an EntityRetriever able to retrieve entities using the given strategy
-
getChannelById
public Mono<Channel> getChannelById(Snowflake channelId)
Description copied from interface:EntityRetriever
Requests to retrieve the channel represented by the supplied ID.- Specified by:
getChannelById
in interfaceEntityRetriever
- Parameters:
channelId
- The ID of the channel.- Returns:
- A
Mono
where, upon successful completion, emits theChannel
as represented by the supplied ID. If an error is received, it is emitted through theMono
.
-
getGuildById
public Mono<Guild> getGuildById(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild represented by the supplied ID.- Specified by:
getGuildById
in interfaceEntityRetriever
- Parameters:
guildId
- The ID of the guild.- Returns:
- A
Mono
where, upon successful completion, emits theGuild
as represented by the supplied ID. If an error is received, it is emitted through theMono
.
-
getGuildStickerById
public Mono<GuildSticker> getGuildStickerById(Snowflake guildId, Snowflake stickerId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild sticker represented by the supplied IDs.- Specified by:
getGuildStickerById
in interfaceEntityRetriever
- Parameters:
guildId
- The ID of the guild.stickerId
- The ID of the sticker.- Returns:
- A
Mono
where, upon successful completion, emits theGuildSticker
as represented by the supplied IDs. If an error is received, it is emitted through theMono
.
-
getGuildEmojiById
public Mono<GuildEmoji> getGuildEmojiById(Snowflake guildId, Snowflake emojiId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild emoji represented by the supplied IDs.- Specified by:
getGuildEmojiById
in interfaceEntityRetriever
- Parameters:
guildId
- The ID of the guild.emojiId
- The ID of the emoji.- Returns:
- A
Mono
where, upon successful completion, emits theGuildEmoji
as represented by the supplied IDs. If an error is received, it is emitted through theMono
.
-
getMemberById
public Mono<Member> getMemberById(Snowflake guildId, Snowflake userId)
Description copied from interface:EntityRetriever
Requests to retrieve the member represented by the supplied IDs. Depending on the implementation, it is possible to lazily request member entities from the Gateway, or the REST API.- Specified by:
getMemberById
in interfaceEntityRetriever
- Parameters:
guildId
- The ID of the guild.userId
- The ID of the user.- Returns:
- A
Mono
where, upon successful completion, emits theMember
as represented by the supplied IDs. If an error is received, it is emitted through theMono
.
-
getMessageById
public Mono<Message> getMessageById(Snowflake channelId, Snowflake messageId)
Description copied from interface:EntityRetriever
Requests to retrieve the message represented by the supplied IDs.- Specified by:
getMessageById
in interfaceEntityRetriever
- Parameters:
channelId
- The ID of the channel.messageId
- The ID of the message.- Returns:
- A
Mono
where, upon successful completion, emits theMessage
as represented by the supplied IDs. If an error is received, it is emitted through theMono
.
-
getRoleById
public Mono<Role> getRoleById(Snowflake guildId, Snowflake roleId)
Description copied from interface:EntityRetriever
Requests to retrieve the role represented by the supplied IDs.- Specified by:
getRoleById
in interfaceEntityRetriever
- Parameters:
guildId
- The ID of the guild.roleId
- The ID of the role.- Returns:
- A
Mono
where, upon successful completion, emits theRole
as represented by the supplied IDs. If an error is received, it is emitted through theMono
.
-
getUserById
public Mono<User> getUserById(Snowflake userId)
Description copied from interface:EntityRetriever
Requests to retrieve the user represented by the supplied ID.- Specified by:
getUserById
in interfaceEntityRetriever
- Parameters:
userId
- The ID of the user.- Returns:
- A
Mono
where, upon successful completion, emits theUser
as represented by the supplied ID. If an error is received, it is emitted through theMono
.
-
getGuilds
public Flux<Guild> getGuilds()
Description copied from interface:EntityRetriever
Requests to retrieve the guilds the current client is in.- Specified by:
getGuilds
in interfaceEntityRetriever
- Returns:
- A
Flux
that continually emits theguilds
that the current client is in. If an error is received, it is emitted through theFlux
.
-
getSelf
public Mono<User> getSelf()
Description copied from interface:EntityRetriever
Requests to retrieve the bot user.- Specified by:
getSelf
in interfaceEntityRetriever
- Returns:
- A
Mono
where, upon successful completion, emits the botuser
. If an error is received, it is emitted through theMono
.
-
getSelfMember
public Mono<Member> getSelfMember(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the bot user represented as amember
of the guild with the supplied ID.- Specified by:
getSelfMember
in interfaceEntityRetriever
- Parameters:
guildId
- The ID of the guild.- Returns:
- A
Mono
where, upon successful completion, emits the botmember
. If an error is received, it is emitted through theMono
.
-
getGuildMembers
public Flux<Member> getGuildMembers(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild's members.- Specified by:
getGuildMembers
in interfaceEntityRetriever
- Parameters:
guildId
- the ID of the guild.- Returns:
- A
Flux
that continually emits themembers
of the guild. If an error is received, it is emitted through theFlux
.
-
getGuildChannels
public Flux<GuildChannel> getGuildChannels(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild's channels.The order of items emitted by the returned
Flux
is unspecified. UseOrderUtil.orderGuildChannels(Flux)
to consistently order channels.- Specified by:
getGuildChannels
in interfaceEntityRetriever
- Parameters:
guildId
- the ID of the guild.- Returns:
- A
Flux
that continually emits the guild'schannels
. If an error is received, it is emitted through theFlux
.
-
getGuildRoles
public Flux<Role> getGuildRoles(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild's roles.The order of items emitted by the returned
Flux
is unspecified. UseOrderUtil.orderRoles(Flux)
to consistently order roles.- Specified by:
getGuildRoles
in interfaceEntityRetriever
- Returns:
- A
Flux
that continually emits the guild'sroles
. If an error is received, it is emitted through theFlux
.
-
getGuildEmojis
public Flux<GuildEmoji> getGuildEmojis(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild's emojis.- Specified by:
getGuildEmojis
in interfaceEntityRetriever
- Returns:
- A
Flux
that continually emits the guild'semojis
. If an error is received, it is emitted through theFlux
.
-
getGuildStickers
public Flux<GuildSticker> getGuildStickers(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild's stickers.- Specified by:
getGuildStickers
in interfaceEntityRetriever
- Returns:
- A
Flux
that continually emits the guild'sstickers
. If an error is received, it is emitted through theFlux
.
-
getGuildAutoModRules
public Flux<AutoModRule> getGuildAutoModRules(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild's automod rules.- Specified by:
getGuildAutoModRules
in interfaceEntityRetriever
- Returns:
- A
Flux
that continually emits the guild'sAutoModRule
. If an error is received, it is emitted through theFlux
.
-
getScheduledEventById
public Mono<ScheduledEvent> getScheduledEventById(Snowflake guildId, Snowflake eventId)
Description copied from interface:EntityRetriever
Requests to retrieve theScheduledEvent
represented by the supplied IDs.- Specified by:
getScheduledEventById
in interfaceEntityRetriever
- Parameters:
guildId
- The ID of the guild.eventId
- The ID of the scheduled event.- Returns:
- A
Mono
where, upon successful completion, emits theScheduledEvent
as represented by the supplied IDs. If an error is received, it is emitted through theMono
.
-
getScheduledEvents
public Flux<ScheduledEvent> getScheduledEvents(Snowflake guildId)
Description copied from interface:EntityRetriever
Requests to retrieve the guild's scheduled events.- Specified by:
getScheduledEvents
in interfaceEntityRetriever
- Returns:
- A
Flux
that continually emits the guild'sevents
. If an error is received, it is emitted through theFlux
.
-
getScheduledEventUsers
public Flux<ScheduledEventUser> getScheduledEventUsers(Snowflake guildId, Snowflake eventId)
Description copied from interface:EntityRetriever
Requests to retrieve the users that subscribed to the event represented by the supplied IDs.- Specified by:
getScheduledEventUsers
in interfaceEntityRetriever
- Returns:
- A
Flux
that continually emits the event'susers
. If an error is received, it is emitted through theFlux
.
-
-