public final class DiscordClient extends Object
Modifier and Type | Method and Description |
---|---|
Mono<Guild> |
createGuild(Consumer<? super GuildCreateSpec> spec)
Requests to create a guild.
|
Mono<User> |
edit(Consumer<? super UserEditSpec> spec)
Requests to edit this client (i.e., modify the current bot user).
|
Mono<ApplicationInfo> |
getApplicationInfo()
Requests to retrieve the application info.
|
Mono<Channel> |
getChannelById(Snowflake channelId)
Requests to retrieve the channel represented by the supplied ID.
|
ClientConfig |
getConfig()
Gets the configuration for this client.
|
EventDispatcher |
getEventDispatcher()
Gets the event dispatcher, allowing reactive subscription of client events.
|
Mono<Guild> |
getGuildById(Snowflake guildId)
Requests to retrieve the guild represented by the supplied ID.
|
Mono<GuildEmoji> |
getGuildEmojiById(Snowflake guildId,
Snowflake emojiId)
Requests to retrieve the guild emoji represented by the supplied IDs.
|
Flux<Guild> |
getGuilds()
Requests to retrieve the guilds the current client is in.
|
Mono<Invite> |
getInvite(String inviteCode)
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.
|
long |
getResponseTime()
Gets the amount of time it last took Discord Gateway to respond to a heartbeat with an ack.
|
Mono<Role> |
getRoleById(Snowflake guildId,
Snowflake roleId)
Requests to retrieve the role represented by the supplied IDs.
|
Mono<User> |
getSelf()
Requests to retrieve the bot user.
|
Optional<Snowflake> |
getSelfId()
Gets the bot user's ID.
|
ServiceMediator |
getServiceMediator()
Obtain the
ServiceMediator associated with this DiscordClient . |
Mono<User> |
getUserById(Snowflake userId)
Requests to retrieve the user represented by the supplied ID.
|
Flux<User> |
getUsers()
Retrieve the currently stored (cached) users.
|
Mono<Webhook> |
getWebhookById(Snowflake webhookId)
Requests to retrieve the webhook represented by the supplied ID.
|
boolean |
isConnected()
Returns whether this client is currently connected to Discord Gateway.
|
Mono<Void> |
login()
Logs in the client to the gateway.
|
Mono<Void> |
logout()
Logs out the client from the gateway.
|
Mono<Void> |
updatePresence(Presence presence)
Update this client
Presence . |
public ServiceMediator getServiceMediator()
ServiceMediator
associated with this DiscordClient
. This is an advanced method to
access underlying middleware and resources.ServiceMediator
for this clientpublic Mono<Channel> getChannelById(Snowflake channelId)
public Mono<Guild> getGuildById(Snowflake guildId)
public Mono<GuildEmoji> getGuildEmojiById(Snowflake guildId, Snowflake emojiId)
guildId
- The ID of the guild.emojiId
- The ID of the emoji.Mono
where, upon successful completion, emits the GuildEmoji
as represented by the
supplied IDs. If an error is received, it is emitted through the Mono
.public Mono<Member> getMemberById(Snowflake guildId, Snowflake userId)
public Mono<Message> getMessageById(Snowflake channelId, Snowflake messageId)
public Mono<Role> getRoleById(Snowflake guildId, Snowflake roleId)
public Mono<User> getUserById(Snowflake userId)
public Mono<Webhook> getWebhookById(Snowflake webhookId)
public Mono<ApplicationInfo> getApplicationInfo()
Mono
where, upon successful completion, emits the application info
. If
an error is received, it is emitted through the Mono
.public Flux<Region> getRegions()
public Optional<Snowflake> getSelfId()
public Mono<Void> login()
Mono
that completes (either successfully or with an error) when the client disconnects from the
gateway without a reconnect attempt. It is recommended to call this from main
and as a final statement
invoke Mono.block()
.public Mono<Void> logout()
Mono
deferring completion until this client has completely disconnected from the gatewaypublic boolean isConnected()
public long getResponseTime()
public Mono<Guild> createGuild(Consumer<? super GuildCreateSpec> spec)
spec
- A Consumer
that provides a "blank" GuildCreateSpec
to be operated on.Mono
where, upon successful completion, emits the created Guild
. If an error is
received, it is emitted through the Mono
.public Mono<Void> updatePresence(Presence presence)
Presence
.presence
- The updated client presence.Mono
that signals completion upon successful update. If an error is received, it is emitted
through the Mono
.public Mono<User> edit(Consumer<? super UserEditSpec> spec)
spec
- A Consumer
that provides a "blank" UserEditSpec
to be operated on.Mono
where, upon successful completion, emits the edited User
. If an error is received,
it is emitted through the Mono
.public EventDispatcher getEventDispatcher()
public ClientConfig getConfig()