Ejemplo n.º 1
0
        public async Task RunAsync()
        {
            if (currentSong != null)
            {
                return;
            }
            await GuildHandler.MainHandler.Client.SetGameAsync(null);

            MusicContext music = MusicHandler.GetMusicQueue().GetNextSong();

            if (music == null)
            {
                return;
            }
            //await MusicHandler.JoinVoiceChannel(await Utils.findVoiceChannel((music.AskedBy as Discord.IGuildUser).Guild as Discord.WebSocket.SocketGuild, GuildHandler.MainHandler.GuildConfigHandler(GuildHandler.Guild).getMusic().VoiceChannel));
            currentSong = music;
            while (currentSong.Song.Status == MusicStatus.DOWNLOADING)
            {
                ;
            }
            if (currentSong.Song.Status == MusicStatus.BROKEN)
            {
                currentSong = null;
                await music.Channel.SendMessageAsync($"Something went wrong when downloading **{music.Song.Title}**. Skipping...");
                await RunAsync();

                return;
            }
            await PlayAudioAsync(music);
        }