Package com.mewna.catnip.shard
Interface CatnipShard
- All Known Implementing Classes:
CatnipShardImpl
public interface CatnipShard
-
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Single<ShardConnectState>
connect()
void
boolean
Checks whether or not the current shard is currently connected to the websocket gateway.long
Return the shard's computed gateway latency, ie.Get the lifecycle state for the current shard.presence()
Return the shard's current presence.void
queueSendToSocket
(com.grack.nanojson.JsonObject json) void
queueVoiceStateUpdate
(com.grack.nanojson.JsonObject json) void
sendToSocket
(com.grack.nanojson.JsonObject json) trace()
Fetches the trace from the shard.void
updatePresence
(PresenceImpl presence)
-
Method Details
-
trace
Fetches the trace from the shard.- Returns:
- The shard's trace.
-
isConnected
@CheckReturnValue boolean isConnected()Checks whether or not the current shard is currently connected to the websocket gateway. This is done as a boolean because - at least for now - there's only 2 meaningful states: connected, and queued to be connected.- Returns:
- Whether or not the shard with the given id is currently connected to the websocket gateway.
-
lifecycleState
Get the lifecycle state for the current shard. This provides more meaningful info thanisConnected()
, because it provides more granular info about the shard's state. However, it does not differentiate between "connected" or not per se; it is up to the end-user to determine whether or not the lifecycle state is actually a state of being "connected."- Returns:
- The lifecycle state of the shard.
-
lastHeartbeatLatency
@CheckReturnValue long lastHeartbeatLatency()Return the shard's computed gateway latency, ie. the time it takes for the shard to send a heartbeat to Discord and get a response.- Returns:
- The shard's computed gateway latency.
-
presence
Return the shard's current presence.- Returns:
- The shard's current presence.
-
connect
-
disconnect
void disconnect() -
updatePresence
-
queueSendToSocket
void queueSendToSocket(@Nonnull com.grack.nanojson.JsonObject json) -
queueVoiceStateUpdate
void queueVoiceStateUpdate(@Nonnull com.grack.nanojson.JsonObject json) -
sendToSocket
void sendToSocket(@Nonnull com.grack.nanojson.JsonObject json)
-