Interface CatnipShard

All Known Implementing Classes:
CatnipShardImpl

public interface CatnipShard
  • Method Details

    • trace

      @Nonnull List<String> 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

      @Nonnull @CheckReturnValue LifecycleState lifecycleState()
      Get the lifecycle state for the current shard. This provides more meaningful info than isConnected(), 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

      @Nonnull @CheckReturnValue Presence presence()
      Return the shard's current presence.
      Returns:
      The shard's current presence.
    • connect

      @Nonnull @CheckReturnValue io.reactivex.rxjava3.core.Single<ShardConnectState> connect()
    • disconnect

      void disconnect()
    • updatePresence

      void updatePresence(@Nonnull PresenceImpl presence)
    • 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)