Package dev.arbjerg.lavalink.client
Class LavalinkClient
-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable,reactor.core.Disposable
public final class LavalinkClient implements Closeable, Disposable
-
-
Field Summary
Fields Modifier and Type Field Description private final List<LavalinkNode>nodesprivate final Flux<ClientEvent<?>>fluxprivate ILoadBalancerloadBalancerprivate final LonguserId
-
Constructor Summary
Constructors Constructor Description LavalinkClient(Long userId)
-
Method Summary
Modifier and Type Method Description final List<LavalinkNode>getNodes()final Flux<ClientEvent<?>>getFlux()final ILoadBalancergetLoadBalancer()To determine the best node, we use a load balancer. final UnitsetLoadBalancer(ILoadBalancer loadBalancer)To determine the best node, we use a load balancer. final LonggetUserId()final LavalinkNodeaddNode(String name, URI address, String password, IRegionFilter regionFilter)Add a node to the client. final LavalinkNodeaddNode(String name, URI address, String password)Add a node to the client. final LinkgetLink(Long guildId, VoiceRegion region)Get or crate a link between a guild and a node. final LinkgetLink(Long guildId)Get or crate a link between a guild and a node. final LinkgetLinkIfCached(Long guildId)Returns a Link if it exists in the cache. final <T extends ClientEvent<?>> Flux<T>on(Class<T> type)final <T extends ClientEvent<?>> Flux<T>on()Unitclose()Close the client and disconnect all nodes. Unitdispose()-
-
Constructor Detail
-
LavalinkClient
LavalinkClient(Long userId)
- Parameters:
userId- ID of the bot for authenticating with Discord
-
-
Method Detail
-
getNodes
final List<LavalinkNode> getNodes()
-
getFlux
final Flux<ClientEvent<?>> getFlux()
-
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 nodeaddress- The ip and port of your nodepassword- The password of your noderegionFilter- (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 nodeaddress- The ip and port of your nodepassword- 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 guildregion- (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.
-
on
final <T extends ClientEvent<?>> Flux<T> on(Class<T> type)
-
on
final <T extends ClientEvent<?>> Flux<T> on()
-
-
-
-