Beispiel #1
0
        private async Task OnReady()
        {
            if (!lavaNode.IsConnected)
            {
                await lavaNode.ConnectAsync();
            }

            if (data.Count <= 0)
            {
                return;
            }

            foreach (KeyValuePair <ulong, LavalinkData> data in data)
            {
                await lavaNode.LeaveAsync(data.Value.VoiceChannel);

                NixPlayer player = await CreatePlayerForGuildAsync(
                    data.Value.VoiceChannel.Guild,
                    data.Value.VoiceChannel,
                    data.Value.TextChannel);

                players.TryAdd(data.Key, player);
                await player.PlayAsync(data.Value);
            }

            data.Clear();
        }
Beispiel #2
0
 public bool TryGetPlayer(IGuild guild, out NixPlayer player)
 {
     if (!players.TryGetValue(guild.Id, out player))
     {
         return(false);
     }
     return(true);
 }
Beispiel #3
0
        public async Task JoinAsync()
        {
            NixPlayer player = await Audio.CreatePlayerForGuildAsync(
                Context.Guild,
                Context.VoiceChannel,
                Context.TextChannel);

            if (player is null)
            {
                await Context.TextChannel.SendMessageAsync("Oh no, something happened...");

                return;
            }

            await Context.TextChannel.SendMessageAsync(
                $"Joined **{player.VoiceChannel.Name}** and bound to **{player.TextChannel.Name}**");
        }