Class LavalinkClient

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable , reactor.core.Disposable

    
    public final class LavalinkClient
     implements Closeable, Disposable
                        
    • Constructor Detail

      • LavalinkClient

        LavalinkClient(Long userId)
        Parameters:
        userId - ID of the bot for authenticating with Discord
    • Method Detail

      • getLoadBalancer

         final ILoadBalancer getLoadBalancer()

        To determine the best node, we use a load balancer. It is recommended to not change the load balancer after you've connected to a voice channel.

      • setLoadBalancer

         final Unit setLoadBalancer(ILoadBalancer loadBalancer)

        To determine the best node, we use a load balancer. It is recommended to not change the load balancer after you've connected to a voice channel.

      • addNode

        @JvmOverloads() final LavalinkNode addNode(String name, URI address, String password, IRegionFilter regionFilter)

        Add a node to the client.

        Parameters:
        name - The name of your node
        address - The ip and port of your node
        password - The password of your node
        regionFilter - (not currently used) Allows you to limit your node to a specific discord voice region
      • addNode

        @JvmOverloads() final LavalinkNode addNode(String name, URI address, String password)

        Add a node to the client.

        Parameters:
        name - The name of your node
        address - The ip and port of your node
        password - The password of your node
      • getLink

        @JvmOverloads() final Link getLink(Long guildId, VoiceRegion region)

        Get or crate a link between a guild and a node.

        Parameters:
        guildId - The id of the guild
        region - (not currently used) The target voice region of when to select a node
      • getLink

        @JvmOverloads() final Link getLink(Long guildId)

        Get or crate a link between a guild and a node.

        Parameters:
        guildId - The id of the guild
      • getLinkIfCached

         final Link getLinkIfCached(Long guildId)

        Returns a Link if it exists in the cache. If we select a link for voice updates, we don't know the region yet.

      • close

         Unit close()

        Close the client and disconnect all nodes.