use of ml.duncte123.skybot.audio.LavalinkNode in project SkyBot by duncte123.
the class LavalinkManager method start.
public void start() {
if (!isEnabled())
return;
String userId = getIdFromToken(AirUtils.CONFIG.getString("discord.token"));
lavalink = new Lavalink(userId, AirUtils.CONFIG.getInt("discord.totalShards", 1), shardId -> SkyBot.getInstance().getShardManager().getShardById(shardId));
List<LavalinkNode> defaultNodes = new ArrayList<>();
defaultNodes.add(new LavalinkNode("ws://localhost", "youshallnotpass"));
List<Ason> nodes = AirUtils.CONFIG.getArray("lavalink.nodes", defaultNodes);
List<LavalinkNode> nodeList = new ArrayList<>();
nodes.forEach(it -> nodeList.add(Ason.deserialize(it, LavalinkNode.class)));
nodeList.forEach(it -> lavalink.addNode(Objects.requireNonNull(toURI(it.wsurl)), it.pass));
}
Aggregations