public final class DiscordClient extends Object
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Guild> |
createGuild(Consumer<? super GuildCreateSpec> spec)
Requests to create a guild.
|
reactor.core.publisher.Mono<User> |
edit(Consumer<? super UserEditSpec> spec)
Requests to edit this client (i.e., modify the current bot user).
|
reactor.core.publisher.Mono<ApplicationInfo> |
getApplicationInfo()
Requests to retrieve the application info.
|
reactor.core.publisher.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.
|
reactor.core.publisher.Mono<Guild> |
getGuildById(Snowflake guildId)
Requests to retrieve the guild represented by the supplied ID.
|
reactor.core.publisher.Mono<GuildEmoji> |
getGuildEmojiById(Snowflake guildId,
Snowflake emojiId)
Requests to retrieve the guild emoji represented by the supplied IDs.
|
reactor.core.publisher.Flux<Guild> |
getGuilds()
Requests to retrieve the guilds the current client is in.
|
reactor.core.publisher.Mono<Invite> |
getInvite(String inviteCode)
Requests to retrieve an invite.
|
reactor.core.publisher.Mono<Member> |
getMemberById(Snowflake guildId,
Snowflake userId)
Requests to retrieve the member represented by the supplied IDs.
|
reactor.core.publisher.Mono<Message> |
getMessageById(Snowflake channelId,
Snowflake messageId)
Requests to retrieve the message represented by the supplied IDs.
|
reactor.core.publisher.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.
|
reactor.core.publisher.Mono<Role> |
getRoleById(Snowflake guildId,
Snowflake roleId)
Requests to retrieve the role represented by the supplied IDs.
|
reactor.core.publisher.Mono<User> |
getSelf()
Requests to retrieve the bot user.
|
Optional<Snowflake> |
getSelfId()
Gets the bot user's ID.
|
reactor.core.publisher.Mono<User> |
getUserById(Snowflake userId)
Requests to retrieve the user represented by the supplied ID.
|
reactor.core.publisher.Flux<User> |
getUsers()
Retrieve the currently stored (cached) users.
|
reactor.core.publisher.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.
|
reactor.core.publisher.Mono<Void> |
login()
Logs in the client to the gateway.
|
void |
logout()
Logs out the client from the gateway.
|
void |
reconnect()
Reconnects the client to the gateway.
|
reactor.core.publisher.Mono<Void> |
updatePresence(Presence presence) |
public reactor.core.publisher.Mono<Channel> getChannelById(Snowflake channelId)
channelId
- The ID of the channel.Mono
where, upon successful completion, emits the Channel
as represented by the
supplied ID. If an error is received, it is emitted through the Mono
.public reactor.core.publisher.Mono<Guild> getGuildById(Snowflake guildId)
guildId
- The ID of the guild.Mono
where, upon successful completion, emits the Guild
as represented by the supplied
ID. If an error is received, it is emitted through the Mono
.public reactor.core.publisher.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 reactor.core.publisher.Mono<Member> getMemberById(Snowflake guildId, Snowflake userId)
guildId
- The ID of the guild.userId
- The ID of the user.Mono
where, upon successful completion, emits the Member
as represented by the supplied
IDs. If an error is received, it is emitted through the Mono
.public reactor.core.publisher.Mono<Message> getMessageById(Snowflake channelId, Snowflake messageId)
channelId
- The ID of the channel.messageId
- The ID of the message.Mono
where, upon successful completion, emits the Message
as represented by the
supplied IDs. If an error is received, it is emitted through the Mono
.public reactor.core.publisher.Mono<Role> getRoleById(Snowflake guildId, Snowflake roleId)
guildId
- The ID of the guild.roleId
- The ID of the role.Mono
where, upon successful completion, emits the Role
as represented by the supplied
IDs. If an error is received, it is emitted through the Mono
.public reactor.core.publisher.Mono<User> getUserById(Snowflake userId)
userId
- The ID of the user.Mono
where, upon successful completion, emits the User
as represented by the supplied
ID. If an error is received, it is emitted through the Mono
.public reactor.core.publisher.Mono<Webhook> getWebhookById(Snowflake webhookId)
webhookId
- The ID of the webhook.Mono
where, upon successful completion, emits the Webhook
as represented by the
supplied ID. If an error is received, it is emitted through the Mono
.public reactor.core.publisher.Mono<ApplicationInfo> getApplicationInfo()
Mono
where, upon successful completion, emits the application info
. If
an error is received, it is emitted through the Mono
.public reactor.core.publisher.Flux<Guild> getGuilds()
Flux
that continually emits the guilds
that the current client is in. If an error
is received, it is emitted through the Flux
.public reactor.core.publisher.Flux<User> getUsers()
Flux
that continually emits the users
that the current client has stored. If an
error is received, it is emitted through the Flux
.public reactor.core.publisher.Flux<Region> getRegions()
Flux
that continually emits the regions
that are available. If an error is
received, it is emitted through the Flux
.public reactor.core.publisher.Mono<User> getSelf()
Mono
where, upon successful completion, emits the bot user
. If an error is
received, it is emitted through the Mono
.public Optional<Snowflake> getSelfId()
public reactor.core.publisher.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 void logout()
public void reconnect()
public boolean isConnected()
public long getResponseTime()
public reactor.core.publisher.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 reactor.core.publisher.Mono<Invite> getInvite(String inviteCode)
inviteCode
- The code for the invite (e.g. "xdYkpp").Mono
where, upon successful completion, emits the Invite
as represented by the
supplied invite code. If an error is received, it is emitted through the Mono
.public reactor.core.publisher.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()