Example #1
0
        private static async Task StartPlay(DUser duser, bool Next = false)
        {
            await DiscordUtils.SendBotMessage(Utils.Replace(Messages.AudioStartedPlaying, "~1", duser.VoiceChannel.Name), duser);

            await duser.VNCon.SendSpeakingAsync(true);

            Video v = MusicBot.FirstPlay();

            if (Next)
            {
                v = MusicBot.NextQueue();
            }
            Random rd        = new Random();
            int    SpecialID = rd.Next(12, 123123);
            await DiscordUtils.SendBotMessage(Utils.Replace(Utils.Replace(Messages.AudioMusicNextSongInQueue, "~2", DUtils.GetMusicURL(v)), "~1", v.Title), duser);

            await MusicBot.VoiceStream(duser.VNCon, v, SpecialID);

            while (MusicBot.Queue.ContainsKey(1))
            {
                Utils.Debug((object)"MusicBot, Playing next song!");
                await Task.Delay(1500);

                v = MusicBot.NextQueue();
                await DiscordUtils.SendBotMessage(Utils.Replace(Utils.Replace(Messages.AudioMusicNextSongInQueue, "~2", DUtils.GetMusicURL(v)), "~1", v.Title), duser);

                await MusicBot.VoiceStream(duser.VNCon, v, SpecialID);
            }
            MusicBot.ClearQueue();
            await DiscordUtils.SendBotMessage(Messages.AudioMusicQueueEnded, duser);
        }