few fixes
This commit is contained in:
		@@ -130,7 +130,7 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                var i = 0;
 | 
			
		||||
                //var i = 0;
 | 
			
		||||
                if (submissions.Count == 0)
 | 
			
		||||
                {
 | 
			
		||||
                    await channel.SendErrorAsync("Acrophobia", "Game ended with no submissions.");
 | 
			
		||||
 
 | 
			
		||||
@@ -49,6 +49,8 @@ namespace NadekoBot.Modules.Music.Classes
 | 
			
		||||
        public string PrettyName => $"**[{SongInfo.Title.TrimTo(70)}]({SongInfo.Query})**";
 | 
			
		||||
 | 
			
		||||
        public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}";
 | 
			
		||||
		
 | 
			
		||||
		public string PTT => $"{PrettyTotalTime}";
 | 
			
		||||
 | 
			
		||||
        public string PrettyFullName => $"{PrettyName}\n\t\t*{PrettyInfo}*";
 | 
			
		||||
 | 
			
		||||
@@ -59,7 +61,7 @@ namespace NadekoBot.Modules.Music.Classes
 | 
			
		||||
                if (TotalTime == TimeSpan.Zero)
 | 
			
		||||
                    return "(?)";
 | 
			
		||||
                else if (TotalTime == TimeSpan.MaxValue)
 | 
			
		||||
                    return "**∞**";
 | 
			
		||||
                    return "∞";
 | 
			
		||||
                else
 | 
			
		||||
                    return TotalTime.ToString(@"mm\:ss");
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ using Newtonsoft.Json.Linq;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
//using System.Threading;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Music
 | 
			
		||||
{
 | 
			
		||||
@@ -216,14 +216,26 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
            var currentSong = musicPlayer.CurrentSong;
 | 
			
		||||
            if (currentSong == null)
 | 
			
		||||
                return;
 | 
			
		||||
            try { await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
 | 
			
		||||
            var videoid = Regex.Match(currentSong.SongInfo.Query, "<=v=[a-zA-Z0-9-]+(?=&)|(?<=[0-9])[^&\n]+|(?<=v=)[^&\n]+");
 | 
			
		||||
 | 
			
		||||
            var embed = new EmbedBuilder()
 | 
			
		||||
                    .WithAuthor(eab => eab.WithName("Now Playing")
 | 
			
		||||
                        .WithMusicIcon())
 | 
			
		||||
                    .WithDescription(currentSong.PrettyName)
 | 
			
		||||
                    .WithFooter(ef => ef.WithText(currentSong.PrettyCurrentTime + "/" + currentSong.PrettyInfo))
 | 
			
		||||
						.WithTitle($"{currentSong.SongInfo.Title}")
 | 
			
		||||
                    .WithDescription(currentSong.PrettyCurrentTime + "/" + currentSong.PTT)
 | 
			
		||||
                    .WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.QueuerName}"))
 | 
			
		||||
                    .WithOkColor();
 | 
			
		||||
			if (currentSong.SongInfo.Provider.Equals("YouTube", StringComparison.OrdinalIgnoreCase))
 | 
			
		||||
			{
 | 
			
		||||
				embed.WithThumbnail(tn => tn.Url = $"https://img.youtube.com/vi/{videoid}/0.jpg");
 | 
			
		||||
				embed.WithUrl($"{currentSong.SongInfo.Query}");
 | 
			
		||||
			}
 | 
			
		||||
			else if (currentSong.SongInfo.Provider.Equals("SoundCloud", StringComparison.OrdinalIgnoreCase))
 | 
			
		||||
			{
 | 
			
		||||
				embed.WithThumbnail(tn => tn.Url = $"{currentSong.SongInfo.AlbumArt}");
 | 
			
		||||
				embed.WithUrl($"{currentSong.SongInfo.Query}");
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
            await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
 | 
			
		||||
        }
 | 
			
		||||
@@ -313,7 +325,8 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
 | 
			
		||||
            var msg =
 | 
			
		||||
                await channel.SendMessageAsync($"🎵 Attempting to queue **{count}** songs".SnPl(count) + "...").ConfigureAwait(false);
 | 
			
		||||
            var cancelSource = new CancellationTokenSource();
 | 
			
		||||
				
 | 
			
		||||
            /*var cancelSource = new CancellationTokenSource();
 | 
			
		||||
 | 
			
		||||
            var tasks = Task.WhenAll(idArray.Select(async id =>
 | 
			
		||||
            {
 | 
			
		||||
@@ -327,7 +340,17 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
                catch { try { cancelSource.Cancel(); } catch { } }
 | 
			
		||||
            }));
 | 
			
		||||
 | 
			
		||||
            await Task.WhenAny(tasks, Task.Delay(Timeout.Infinite, cancelSource.Token));
 | 
			
		||||
            await Task.WhenAny(tasks, Task.Delay(Timeout.Infinite, cancelSource.Token));*/
 | 
			
		||||
			
 | 
			
		||||
			foreach (var id in idArray)
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, id, true).ConfigureAwait(false);
 | 
			
		||||
                }
 | 
			
		||||
                catch (SongNotFoundException) { }
 | 
			
		||||
                catch { break; }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            await msg.ModifyAsync(m => m.Content = "✅ Playlist queue complete.").ConfigureAwait(false);
 | 
			
		||||
        }
 | 
			
		||||
@@ -824,6 +847,7 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
                    {
 | 
			
		||||
                        if (finishedMessage != null)
 | 
			
		||||
                            finishedMessage.DeleteAfter(0);
 | 
			
		||||
						
 | 
			
		||||
                        finishedMessage = await textCh.EmbedAsync(new EmbedBuilder().WithOkColor()
 | 
			
		||||
                                                  .WithAuthor(eab => eab.WithName("Finished Song").WithMusicIcon())
 | 
			
		||||
                                                  .WithDescription(song.PrettyName)
 | 
			
		||||
@@ -839,8 +863,10 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
                    catch { }
 | 
			
		||||
                };
 | 
			
		||||
                IUserMessage playingMessage = null;
 | 
			
		||||
				
 | 
			
		||||
                mp.OnStarted += async (player, song) =>
 | 
			
		||||
                {
 | 
			
		||||
					try { await mp.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
                        if (playingMessage != null)
 | 
			
		||||
@@ -870,7 +896,7 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
                            pauseMessage = await textCh.SendConfirmAsync("🎵 Music playback **resumed**.").ConfigureAwait(false);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (pauseMessage != null)
 | 
			
		||||
                            pauseMessage.DeleteAfter(15);
 | 
			
		||||
                            pauseMessage.DeleteAfter(5);
 | 
			
		||||
                    }
 | 
			
		||||
                    catch { }
 | 
			
		||||
                };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user