Search in sources :

Example 1 with Ason

use of com.afollestad.ason.Ason 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));
}
Also used : Link(lavalink.client.io.Link) AudioUtils(ml.duncte123.skybot.utils.AudioUtils) VoiceChannel(net.dv8tion.jda.core.entities.VoiceChannel) LavalinkNode(ml.duncte123.skybot.audio.LavalinkNode) URISyntaxException(java.net.URISyntaxException) LavaplayerPlayerWrapper(lavalink.client.player.LavaplayerPlayerWrapper) IPlayer(lavalink.client.player.IPlayer) Ason(com.afollestad.ason.Ason) ArrayList(java.util.ArrayList) Objects(java.util.Objects) Guild(net.dv8tion.jda.core.entities.Guild) Base64(java.util.Base64) List(java.util.List) Lavalink(lavalink.client.io.Lavalink) SkyBot(ml.duncte123.skybot.SkyBot) URI(java.net.URI) NotNull(org.jetbrains.annotations.NotNull) AirUtils(ml.duncte123.skybot.utils.AirUtils) Lavalink(lavalink.client.io.Lavalink) LavalinkNode(ml.duncte123.skybot.audio.LavalinkNode) ArrayList(java.util.ArrayList) Ason(com.afollestad.ason.Ason)

Aggregations

Ason (com.afollestad.ason.Ason)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 Base64 (java.util.Base64)1 List (java.util.List)1 Objects (java.util.Objects)1 Lavalink (lavalink.client.io.Lavalink)1 Link (lavalink.client.io.Link)1 IPlayer (lavalink.client.player.IPlayer)1 LavaplayerPlayerWrapper (lavalink.client.player.LavaplayerPlayerWrapper)1 SkyBot (ml.duncte123.skybot.SkyBot)1 LavalinkNode (ml.duncte123.skybot.audio.LavalinkNode)1 AirUtils (ml.duncte123.skybot.utils.AirUtils)1 AudioUtils (ml.duncte123.skybot.utils.AudioUtils)1 Guild (net.dv8tion.jda.core.entities.Guild)1 VoiceChannel (net.dv8tion.jda.core.entities.VoiceChannel)1 NotNull (org.jetbrains.annotations.NotNull)1